[qml] Qt5.15: Disable the alternative palette to support disabled elements

Supporting the alternative palette (triggered with Ctrl+Shift+P) requires
a manual conversion from the QPalette to the QML palette, which does not
directly support disabled elements.

Keeping the previous palette management will support disabled elements,
but cause issues when switching to the alternative palette. Until both
can be fully supported, the alternative palette is disabled.
This commit is contained in:
Candice Bentéjac 2023-02-16 11:33:47 +01:00
parent 8db25a6f89
commit 30cd13c7b3

View file

@ -39,6 +39,10 @@ ApplicationWindow {
ensureSaved(function(){ Qt.quit() })
}
palette: _PaletteManager.palette
// TODO: uncomment for Qt6, which correctly supports palette for disabled elements AND an alternate base
/*
// QPalette is not convertible to QML palette (anymore)
Component.onCompleted: {
palette.alternateBase = _PaletteManager.alternateBase
@ -56,13 +60,13 @@ ApplicationWindow {
palette.window = _PaletteManager.window
palette.windowText = _PaletteManager.windowText
// TODO: uncomment for Qt6, which supports palette for disabled elements
/* palette.disabled.buttonText = _PaletteManager.disabledButtonText
palette.disabled.buttonText = _PaletteManager.disabledButtonText
palette.disabled.highlight = _PaletteManager.disabledHighlight
palette.disabled.highlightedText = _PaletteManager.disabledHighlightedText
palette.disabled.text = _PaletteManager.disabledText
palette.disabled.windowText = _PaletteManager.disabledWindowText */
}
palette.disabled.windowText = _PaletteManager.disabledWindowText
} */
SystemPalette { id: activePalette }
SystemPalette { id: disabledPalette; colorGroup: SystemPalette.Disabled }
@ -560,10 +564,12 @@ ApplicationWindow {
}
}
Action {
// TODO: uncomment for Qt6 to re-enable the alternative palette (the alternative palette and the disabled items currently cannot both be supported)
/* Action {
shortcut: "Ctrl+Shift+P"
onTriggered: _PaletteManager.togglePalette()
}
} */
// Utility functions for elements in the menubar