diff options
-rw-r--r-- | src/imports/controls/material/qquickmaterialstyle.cpp | 2 | ||||
-rw-r--r-- | tests/auto/material/data/tst_material.qml | 47 |
2 files changed, 49 insertions, 0 deletions
diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp index 7355c2d6..d7a25914 100644 --- a/src/imports/controls/material/qquickmaterialstyle.cpp +++ b/src/imports/controls/material/qquickmaterialstyle.cpp @@ -525,6 +525,7 @@ void QQuickMaterialStyle::inheritPrimary(uint primary, bool custom) m_primary = primary; propagatePrimary(); emit primaryChanged(); + emit paletteChanged(); } } @@ -595,6 +596,7 @@ void QQuickMaterialStyle::inheritAccent(uint accent, bool custom) m_accent = accent; propagateAccent(); emit accentChanged(); + emit paletteChanged(); } } diff --git a/tests/auto/material/data/tst_material.qml b/tests/auto/material/data/tst_material.qml index c686fef8..6e9d742e 100644 --- a/tests/auto/material/data/tst_material.qml +++ b/tests/auto/material/data/tst_material.qml @@ -111,6 +111,26 @@ TestCase { } Component { + id: popupComponent + ApplicationWindow { + Material.primary: Material.Blue + Material.accent: Material.Red + visible: true + property alias popup: popupInstance + property alias label: labelInstance + Popup { + id: popupInstance + Label { + id: labelInstance + text: "test" + color: popupInstance.Material.textSelectionColor + } + Component.onCompleted: open() + } + } + } + + Component { id: comboBox ApplicationWindow { width: 200 @@ -227,6 +247,33 @@ TestCase { parent.destroy() } + function test_inheritance_popup_data() { + return [ + { tag: "primary", value1: Material.color(Material.Amber), value2: Material.color(Material.Indigo) }, + { tag: "accent", value1: Material.color(Material.Amber), value2: Material.color(Material.Indigo) }, + { tag: "theme", value1: Material.Dark, value2: Material.Light }, + ] + } + + function test_inheritance_popup(data) { + var prop = data.tag + var popupObject = popupComponent.createObject(testCase) + compare(popupObject.popup.Material.textSelectionColor.toString(), popupObject.Material.textSelectionColor.toString()) + compare(popupObject.label.color.toString(), popupObject.Material.textSelectionColor.toString()) + + popupObject.Material[prop] = data.value1 + compare(popupObject.Material[prop], data.value1) + compare(popupObject.popup.Material.textSelectionColor.toString(), popupObject.Material.textSelectionColor.toString()) + compare(popupObject.label.color.toString(), popupObject.Material.textSelectionColor.toString()) + + popupObject.Material[prop] = data.value2 + compare(popupObject.Material[prop], data.value2) + compare(popupObject.popup.Material.textSelectionColor.toString(), popupObject.Material.textSelectionColor.toString()) + compare(popupObject.label.color.toString(), popupObject.Material.textSelectionColor.toString()) + + popupObject.destroy() + } + function test_window() { var parent = window.createObject() |