title: How to center background image in QWidget
body: <p>The code below creates a singe QTableView with the jpg image set as background.</p>
  
  <p>I would like this background image to be centered instead of aligned with the left and top edges. How to position the background image at the center?</p>
  
  <pre><code>from PySide2.QtGui import *
  from PySide2.QtWidgets import *
  from PySide2.QtCore import *
  
  app = QApplication([])
  view = QTableView()
  view.resize(1000, 600)
  bg_image = 'stackoverflow.jpg'
  view.setStyleSheet("background-repeat:no-repeat;background-image:url(%s)" % bg_image)
  view.show()
  app.exec_()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/D3AyN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D3AyN.png" alt="enter image description here"></a></p>