Fix brush for disabled novel selector (#2482)
This commit is contained in:
@@ -34,6 +34,7 @@ from PyQt6.QtWidgets import QComboBox
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.constants import nwLabels
|
||||
from novelwriter.enum import nwItemClass
|
||||
from novelwriter.types import QtColDisabled
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from PyQt6.QtWidgets import QWidget
|
||||
@@ -93,7 +94,9 @@ class NovelSelector(QComboBox):
|
||||
def updateTheme(self) -> None:
|
||||
"""Update theme colours."""
|
||||
palette = self.palette()
|
||||
palette.setBrush(QPalette.ColorGroup.Disabled, QPalette.ColorRole.Text, palette.text())
|
||||
palette.setBrush(QtColDisabled, QPalette.ColorRole.Text, palette.text())
|
||||
palette.setBrush(QtColDisabled, QPalette.ColorRole.WindowText, palette.windowText())
|
||||
palette.setBrush(QtColDisabled, QPalette.ColorRole.ButtonText, palette.buttonText())
|
||||
self.setPalette(palette)
|
||||
self.refreshNovelList()
|
||||
|
||||
|
||||
@@ -45,7 +45,10 @@ from novelwriter.constants import nwLabels
|
||||
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType, nwStandardButton, nwTheme
|
||||
from novelwriter.error import logException
|
||||
from novelwriter.extensions.modified import NPushButton
|
||||
from novelwriter.types import QtBlack, QtHexArgb, QtPaintAntiAlias, QtTransparent
|
||||
from novelwriter.types import (
|
||||
QtBlack, QtColActive, QtColDisabled, QtColInactive, QtHexArgb,
|
||||
QtPaintAntiAlias, QtTransparent
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
@@ -439,10 +442,6 @@ class GuiTheme:
|
||||
window = self._guiPalette.window().color()
|
||||
highlight = self._guiPalette.highlight().color()
|
||||
|
||||
QtColActive = QPalette.ColorGroup.Active
|
||||
QtColInactive = QPalette.ColorGroup.Inactive
|
||||
QtColDisabled = QPalette.ColorGroup.Disabled
|
||||
|
||||
if window.lightnessF() < 0.15:
|
||||
# If window is too dark, we need a lighter ref colour for shades
|
||||
ref = QColor.fromHslF(window.hueF(), window.saturationF(), 0.15, window.alphaF())
|
||||
|
||||
+12
-5
@@ -24,10 +24,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from __future__ import annotations
|
||||
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtGui import QColor, QFont, QPainter, QTextCharFormat, QTextCursor, QTextFormat
|
||||
from PyQt6.QtGui import (
|
||||
QColor, QFont, QPainter, QPalette, QTextCharFormat, QTextCursor,
|
||||
QTextFormat
|
||||
)
|
||||
from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QHeaderView, QSizePolicy, QStyle
|
||||
|
||||
# Qt Alignment Flags
|
||||
# Alignment Flags
|
||||
|
||||
QtAlignAbsolute = Qt.AlignmentFlag.AlignAbsolute
|
||||
QtAlignCenter = Qt.AlignmentFlag.AlignCenter
|
||||
@@ -48,7 +51,7 @@ QtVAlignNormal = QTextCharFormat.VerticalAlignment.AlignNormal
|
||||
QtVAlignSub = QTextCharFormat.VerticalAlignment.AlignSubScript
|
||||
QtVAlignSuper = QTextCharFormat.VerticalAlignment.AlignSuperScript
|
||||
|
||||
# Qt Text Formats
|
||||
# Text Formats
|
||||
|
||||
QtPageBreakBefore = QTextFormat.PageBreakFlag.PageBreak_AlwaysBefore
|
||||
QtPageBreakAfter = QTextFormat.PageBreakFlag.PageBreak_AlwaysAfter
|
||||
@@ -58,7 +61,7 @@ QtTextUserProperty = QTextFormat.Property.UserProperty
|
||||
|
||||
QtPropLineHeight = 1 # QTextBlockFormat.LineHeightTypes.ProportionalHeight
|
||||
|
||||
# Qt Painter Types
|
||||
# Painter Types
|
||||
|
||||
QtTransparent = QColor(0, 0, 0, 0)
|
||||
QtBlack = QColor(0, 0, 0)
|
||||
@@ -70,11 +73,15 @@ QtPaintAntiAlias = QPainter.RenderHint.Antialiasing
|
||||
QtMouseOver = QStyle.StateFlag.State_MouseOver
|
||||
QtSelected = QStyle.StateFlag.State_Selected
|
||||
|
||||
# Qt Colour Types
|
||||
# Colour Types
|
||||
|
||||
QtHexRgb = QColor.NameFormat.HexRgb
|
||||
QtHexArgb = QColor.NameFormat.HexArgb
|
||||
|
||||
QtColActive = QPalette.ColorGroup.Active
|
||||
QtColInactive = QPalette.ColorGroup.Inactive
|
||||
QtColDisabled = QPalette.ColorGroup.Disabled
|
||||
|
||||
# Qt Tree and Table Types
|
||||
|
||||
QtDecoration = Qt.ItemDataRole.DecorationRole
|
||||
|
||||
Reference in New Issue
Block a user