Skip to content

Commit

Permalink
[qml] Qt5.15: Disable the alternative palette to support disabled ele…
Browse files Browse the repository at this point in the history
…ments

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.
  • Loading branch information
cbentejac committed Jul 4, 2023
1 parent 830f777 commit e1ada83
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions meshroom/ui/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e1ada83

Please sign in to comment.