drop lack of palette compatibility with Qt4

This commit is contained in:
KIU Shueng Chuan 2021-01-14 12:34:48 +08:00
parent 966ae7a3df
commit 283e9eb563
2 changed files with 7 additions and 11 deletions

View File

@ -131,10 +131,9 @@ class GraphicsView(QtGui.QGraphicsView):
self.clickAccepted = False
# Set a transparent background QPalette!
if QT_LIB in ["PySide2", "PyQt5"]:
palette = self.palette()
palette.setColor(QtGui.QPalette.Window, QtCore.Qt.transparent)
self.setPalette(palette)
palette = self.palette()
palette.setColor(QtGui.QPalette.Window, QtCore.Qt.transparent)
self.setPalette(palette)
def setAntialiasing(self, aa):
"""Enable or disable default antialiasing.

View File

@ -11,9 +11,8 @@ def test_basics_graphics_view():
palette = view.palette()
if pg.Qt.QT_LIB in ["PySide2", "PyQt5"]:
assert palette.isBrushSet(QtGui.QPalette.Active, QtGui.QPalette.Window)
assert palette.color(QtGui.QPalette.Window) == QtCore.Qt.transparent
assert palette.isBrushSet(QtGui.QPalette.Active, QtGui.QPalette.Window)
assert palette.color(QtGui.QPalette.Window) == QtCore.Qt.transparent
assert view.backgroundBrush().color() == QtGui.QColor(0, 0, 0, 255)
assert view.focusPolicy() == QtCore.Qt.StrongFocus
@ -39,10 +38,8 @@ def test_basics_graphics_view():
view.setBackground("w")
assert view._background == "w"
palette = view.palette()
if pg.Qt.QT_LIB in ["PySide2", "PyQt5"]:
assert palette.isBrushSet(QtGui.QPalette.Active, QtGui.QPalette.Window)
assert palette.color(QtGui.QPalette.Window) == QtCore.Qt.transparent
assert palette.isBrushSet(QtGui.QPalette.Active, QtGui.QPalette.Window)
assert palette.color(QtGui.QPalette.Window) == QtCore.Qt.transparent
assert view.backgroundBrush().color() == QtCore.Qt.white
# Set anti aliasing