Skip to content

Commit

Permalink
Merge pull request #3966 from t20100/fix-qpalette-normal
Browse files Browse the repository at this point in the history
silx.gui: Fixed PyQt6 support by not using deprecated `qt.QPalette.Normal`
  • Loading branch information
vasole authored Nov 21, 2023
2 parents e3b5eab + f22f6d1 commit 92feec5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/silx/gui/dialog/ColormapDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def _updateAutoScaleState(self, isAutoScale):
color = palette.color(qt.QPalette.Disabled, qt.QPalette.Base)
icon = self._iconAuto
else:
color = palette.color(qt.QPalette.Normal, qt.QPalette.Base)
color = palette.color(qt.QPalette.Active, qt.QPalette.Base)
icon = self._iconFixed
palette.setColor(qt.QPalette.Base, color)
self._numVal.setPalette(palette)
Expand Down Expand Up @@ -515,7 +515,7 @@ def _initPlot(self):
self._plot.setMinimumSize(qt.QSize(250, 200))
self._plot.sigPlotSignal.connect(self._plotEventReceived)
palette = self.palette()
color = palette.color(qt.QPalette.Normal, qt.QPalette.Window)
color = palette.color(qt.QPalette.Active, qt.QPalette.Window)
self._plot.setBackgroundColor(color)
self._plot.setDataBackgroundColor("white")

Expand Down
6 changes: 3 additions & 3 deletions src/silx/gui/plot/LegendSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def data(self, modelIndex, role):
elif role == qt.Qt.BackgroundRole:
# Background color, must be QBrush
if isActive:
brush = self._palette.brush(qt.QPalette.Normal, qt.QPalette.Highlight)
brush = self._palette.brush(qt.QPalette.Active, qt.QPalette.Highlight)
elif idx % 2:
brush = qt.QBrush(qt.QColor(240, 240, 240))
else:
Expand All @@ -203,9 +203,9 @@ def data(self, modelIndex, role):
elif role == qt.Qt.ForegroundRole:
# ForegroundRole color, must be QBrush
if isActive:
brush = self._palette.brush(qt.QPalette.Normal, qt.QPalette.HighlightedText)
brush = self._palette.brush(qt.QPalette.Active, qt.QPalette.HighlightedText)
else:
brush = self._palette.brush(qt.QPalette.Normal, qt.QPalette.WindowText)
brush = self._palette.brush(qt.QPalette.Active, qt.QPalette.WindowText)
return brush
elif role == qt.Qt.CheckStateRole:
return bool(item[2]) # item[2] == True
Expand Down

0 comments on commit 92feec5

Please sign in to comment.