下面的代码创建一个单独的qtableview,并将JPG图像设置为背景。
我希望此背景图像居中,而不是与左边缘和上边缘对齐。如何将背景图像定位在中间?
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_()