diff options
-rw-r--r-- | src/imports/controls/material/qquickmaterialstyle.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qquickmaterialstyle/data/tst_material.qml | 40 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp index 8562cdbb..3676bdbb 100644 --- a/src/imports/controls/material/qquickmaterialstyle.cpp +++ b/src/imports/controls/material/qquickmaterialstyle.cpp @@ -1020,6 +1020,8 @@ QColor QQuickMaterialStyle::scrollBarPressedColor() const QColor QQuickMaterialStyle::dialogColor() const { + if (m_hasBackground) + return backgroundColor(); return QColor::fromRgba(m_theme == Light ? dialogColorLight : dialogColorDark); } @@ -1035,6 +1037,8 @@ QColor QQuickMaterialStyle::listHighlightColor() const QColor QQuickMaterialStyle::tooltipColor() const { + if (m_explicitBackground) + return backgroundColor(); return color(Grey, Shade700); } diff --git a/tests/auto/qquickmaterialstyle/data/tst_material.qml b/tests/auto/qquickmaterialstyle/data/tst_material.qml index 1cd1d16d..727de2e4 100644 --- a/tests/auto/qquickmaterialstyle/data/tst_material.qml +++ b/tests/auto/qquickmaterialstyle/data/tst_material.qml @@ -629,4 +629,44 @@ TestCase { appWindow.destroy() } + + Component { + id: popups + ApplicationWindow { + id: window + property Drawer drawer: Drawer { parent: window.contentItem } + property Menu menu: Menu { parent: window.contentItem; visible: true } + property Popup popup: Popup { parent: window.contentItem; visible: true } + property ToolTip tooltip: ToolTip { parent: window.contentItem; visible: true } + } + } + + function test_popupBackground_data() { + return [ + { tag: "drawer", inherit: true }, + { tag: "menu", inherit: true }, + { tag: "popup", inherit: true }, + { tag: "tooltip", inherit: false } + ] + } + + function test_popupBackground(data) { + var window = popups.createObject(testCase) + verify(window) + + var control = window[data.tag] + verify(control) + + window.Material.background = "#ff0000" + compare(window.color, "#ff0000") + if (data.inherit) + compare(control.background.color, "#ff0000") + else + verify(control.background !== "#ff0000") + + control.Material.background = "#0000ff" + compare(control.background.color, "#0000ff") + + window.destroy() + } } |