change QPalette.Background to QPalette.Window

the former is obsolete in 5.15 and is removed in 6.0
This commit is contained in:
KIU Shueng Chuan 2021-01-10 20:09:29 +08:00
parent c4addbeaea
commit da0a94643c
2 changed files with 6 additions and 6 deletions

View File

@ -133,7 +133,7 @@ class GraphicsView(QtGui.QGraphicsView):
# Set a transparent background QPalette! # Set a transparent background QPalette!
if QT_LIB in ["PySide2", "PyQt5"]: if QT_LIB in ["PySide2", "PyQt5"]:
palette = self.palette() palette = self.palette()
palette.setColor(QtGui.QPalette.Background, QtCore.Qt.transparent) palette.setColor(QtGui.QPalette.Window, QtCore.Qt.transparent)
self.setPalette(palette) self.setPalette(palette)
def setAntialiasing(self, aa): def setAntialiasing(self, aa):

View File

@ -7,13 +7,13 @@ def test_basics_graphics_view():
app = pg.mkQApp() app = pg.mkQApp()
view = pg.GraphicsView() view = pg.GraphicsView()
background_role = view.backgroundRole() background_role = view.backgroundRole()
assert background_role == QtGui.QPalette.Background assert background_role == QtGui.QPalette.Window
palette = view.palette() palette = view.palette()
if pg.Qt.QT_LIB in ["PySide2", "PyQt5"]: if pg.Qt.QT_LIB in ["PySide2", "PyQt5"]:
assert palette.isBrushSet(QtGui.QPalette.Active, QtGui.QPalette.Background) assert palette.isBrushSet(QtGui.QPalette.Active, QtGui.QPalette.Window)
assert palette.color(QtGui.QPalette.Background) == QtCore.Qt.transparent assert palette.color(QtGui.QPalette.Window) == QtCore.Qt.transparent
assert view.backgroundBrush().color() == QtGui.QColor(0, 0, 0, 255) assert view.backgroundBrush().color() == QtGui.QColor(0, 0, 0, 255)
assert view.focusPolicy() == QtCore.Qt.StrongFocus assert view.focusPolicy() == QtCore.Qt.StrongFocus
@ -41,8 +41,8 @@ def test_basics_graphics_view():
palette = view.palette() palette = view.palette()
if pg.Qt.QT_LIB in ["PySide2", "PyQt5"]: if pg.Qt.QT_LIB in ["PySide2", "PyQt5"]:
assert palette.isBrushSet(QtGui.QPalette.Active, QtGui.QPalette.Background) assert palette.isBrushSet(QtGui.QPalette.Active, QtGui.QPalette.Window)
assert palette.color(QtGui.QPalette.Background) == QtCore.Qt.transparent assert palette.color(QtGui.QPalette.Window) == QtCore.Qt.transparent
assert view.backgroundBrush().color() == QtCore.Qt.white assert view.backgroundBrush().color() == QtCore.Qt.white
# Set anti aliasing # Set anti aliasing