From e48f1189508fcf7b12e987835ad00dc0473b1cc7 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 7 Jan 2016 12:51:47 +0100 Subject: Fix plugins.qmltypes for designer Multiple definitions of "QQuickItem" break the inheritance hierarchy required for Qt Quick Designer. Change-Id: I867a2fa7cdbb0054518c566ae31d8d9dc859b7a1 Reviewed-by: Marco Benelli Reviewed-by: J-P Nurmi --- src/imports/controls/plugins.qmltypes | 154 ---------------------------------- 1 file changed, 154 deletions(-) diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes index 518a9b6c..7ffa52be 100644 --- a/src/imports/controls/plugins.qmltypes +++ b/src/imports/controls/plugins.qmltypes @@ -266,160 +266,6 @@ Module { Signal { name: "implicitWidthChanged2"; revision: 1 } Signal { name: "implicitHeightChanged2"; revision: 1 } } - Component { - name: "QQuickItem" - defaultProperty: "data" - prototype: "QObject" - Enum { - name: "TransformOrigin" - values: { - "TopLeft": 0, - "Top": 1, - "TopRight": 2, - "Left": 3, - "Center": 4, - "Right": 5, - "BottomLeft": 6, - "Bottom": 7, - "BottomRight": 8 - } - } - Property { name: "parent"; type: "QQuickItem"; isPointer: true } - Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } - Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true } - Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } - Property { name: "x"; type: "double" } - Property { name: "y"; type: "double" } - Property { name: "z"; type: "double" } - Property { name: "width"; type: "double" } - Property { name: "height"; type: "double" } - Property { name: "opacity"; type: "double" } - Property { name: "enabled"; type: "bool" } - Property { name: "visible"; type: "bool" } - Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true } - Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } - Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } - Property { name: "state"; type: "string" } - Property { name: "childrenRect"; type: "QRectF"; isReadonly: true } - Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true } - Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "baselineOffset"; type: "double" } - Property { name: "clip"; type: "bool" } - Property { name: "focus"; type: "bool" } - Property { name: "activeFocus"; type: "bool"; isReadonly: true } - Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } - Property { name: "rotation"; type: "double" } - Property { name: "scale"; type: "double" } - Property { name: "transformOrigin"; type: "TransformOrigin" } - Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true } - Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true } - Property { name: "smooth"; type: "bool" } - Property { name: "antialiasing"; type: "bool" } - Property { name: "implicitWidth"; type: "double" } - Property { name: "implicitHeight"; type: "double" } - Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true } - Signal { - name: "childrenRectChanged" - Parameter { type: "QRectF" } - } - Signal { - name: "baselineOffsetChanged" - Parameter { type: "double" } - } - Signal { - name: "stateChanged" - Parameter { type: "string" } - } - Signal { - name: "focusChanged" - Parameter { type: "bool" } - } - Signal { - name: "activeFocusChanged" - Parameter { type: "bool" } - } - Signal { - name: "activeFocusOnTabChanged" - revision: 1 - Parameter { type: "bool" } - } - Signal { - name: "parentChanged" - Parameter { type: "QQuickItem"; isPointer: true } - } - Signal { - name: "transformOriginChanged" - Parameter { type: "TransformOrigin" } - } - Signal { - name: "smoothChanged" - Parameter { type: "bool" } - } - Signal { - name: "antialiasingChanged" - Parameter { type: "bool" } - } - Signal { - name: "clipChanged" - Parameter { type: "bool" } - } - Signal { - name: "windowChanged" - revision: 1 - Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } - } - Method { name: "update" } - Method { - name: "grabToImage" - revision: 2 - type: "bool" - Parameter { name: "callback"; type: "QJSValue" } - Parameter { name: "targetSize"; type: "QSize" } - } - Method { - name: "grabToImage" - revision: 2 - type: "bool" - Parameter { name: "callback"; type: "QJSValue" } - } - Method { - name: "contains" - type: "bool" - Parameter { name: "point"; type: "QPointF" } - } - Method { - name: "mapFromItem" - Parameter { type: "QQmlV4Function"; isPointer: true } - } - Method { - name: "mapToItem" - Parameter { type: "QQmlV4Function"; isPointer: true } - } - Method { name: "forceActiveFocus" } - Method { - name: "forceActiveFocus" - Parameter { name: "reason"; type: "Qt::FocusReason" } - } - Method { - name: "nextItemInFocusChain" - revision: 1 - type: "QQuickItem*" - Parameter { name: "forward"; type: "bool" } - } - Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" } - Method { - name: "childAt" - type: "QQuickItem*" - Parameter { name: "x"; type: "double" } - Parameter { name: "y"; type: "double" } - } - } Component { name: "QQuickItemDelegate" defaultProperty: "data" -- cgit v1.2.3 From 93a79811137172275ab87fbfc61355f56da07397 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 7 Jan 2016 17:31:16 +0100 Subject: tst_combobox: set size for the test case Should help with the warning that sometimes appears in the CI: QWARN : tst_styles(material)::UnknownTestFunc() QWindowsWindow::setGeometry: Unable to set geometry 0x0+66+112 on QQuickView/'tst_combobox'. Resulting geometry: 124x0+66+112 (frame: 8, 31, 8, 8, custom margin: 0, 0, 0, 0, minimum size: 0x0, maximum size: 16777215x16777215). Change-Id: I913ae09dfad4d1ef914ed589466ede6d62bece79 Reviewed-by: J-P Nurmi --- tests/auto/controls/data/tst_combobox.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 11390bb8..d74c52aa 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -44,6 +44,8 @@ import Qt.labs.controls 1.0 TestCase { id: testCase + width: 200 + height: 200 name: "ComboBox" ApplicationWindow { -- cgit v1.2.3 From 8ca88664aceeb4e1b3ebd51c0e8400a6af20da71 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 6 Jan 2016 23:05:39 +0100 Subject: Material: fix BusyIndicator on high DPI Take the device pixel ratio into account Change-Id: Icd2aa70018254975675d284ce77f6db02af9517a Reviewed-by: Mitch Curtis --- src/imports/controls/material/qquickmaterialprogressring.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/imports/controls/material/qquickmaterialprogressring.cpp b/src/imports/controls/material/qquickmaterialprogressring.cpp index 54728686..c11a347f 100644 --- a/src/imports/controls/material/qquickmaterialprogressring.cpp +++ b/src/imports/controls/material/qquickmaterialprogressring.cpp @@ -74,6 +74,7 @@ public: void afterNodeSync() Q_DECL_OVERRIDE; private: + qreal m_devicePixelRatio; QSGNode *m_containerNode; QQuickWindow *m_window; }; @@ -165,6 +166,7 @@ QQuickAnimatorJob *QQuickMaterialRingAnimator::createJob() const } QQuickMaterialRingAnimatorJob::QQuickMaterialRingAnimatorJob() : + m_devicePixelRatio(1.0), m_containerNode(Q_NULLPTR), m_window(Q_NULLPTR) { @@ -179,6 +181,7 @@ void QQuickMaterialRingAnimatorJob::initialize(QQuickAnimatorController *control QQuickAnimatorJob::initialize(controller); m_containerNode = QQuickItemPrivate::get(m_target)->childContainerNode(); m_window = m_target->window(); + m_devicePixelRatio = m_window->effectiveDevicePixelRatio(); } void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) @@ -192,8 +195,8 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); - const qreal width = rectNode->rect().width(); - const qreal height = rectNode->rect().height(); + const qreal width = rectNode->rect().width() * m_devicePixelRatio; + const qreal height = rectNode->rect().height() * m_devicePixelRatio; QImage image(width, height, QImage::Format_ARGB32_Premultiplied); image.fill(Qt::transparent); @@ -203,7 +206,7 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) QPen pen; QQuickMaterialRingTexture *textureNode = static_cast(rectNode->firstChild()); pen.setColor(textureNode->color()); - pen.setWidth(4); + pen.setWidth(4 * m_devicePixelRatio); painter.setPen(pen); const qreal percentageComplete = time / qreal(rotationAnimationDuration); @@ -237,7 +240,7 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) } const int halfPen = pen.width() / 2; - const QRectF arcBounds = QRectF(rectNode->rect().adjusted(halfPen, halfPen, -halfPen, -halfPen)); + const QRectF arcBounds = QRectF(halfPen, halfPen, width - pen.width(), height - pen.width()); // The current angle of the rotation animation. const qreal rotation = oneDegree * percentageComplete * -targetRotation; startAngle -= rotation; -- cgit v1.2.3 From ddebc2d5ded6e08449b10311dd3c6634c84d71b5 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 7 Jan 2016 13:46:22 +0100 Subject: Material: sync ProgressBar height with Android Change-Id: I4e7864e39fcf6dc8f3f0f821e2c9129a472967ba Reviewed-by: Mitch Curtis --- src/imports/controls/material/ProgressBar.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imports/controls/material/ProgressBar.qml b/src/imports/controls/material/ProgressBar.qml index 34e1aaea..709ac28d 100644 --- a/src/imports/controls/material/ProgressBar.qml +++ b/src/imports/controls/material/ProgressBar.qml @@ -66,7 +66,7 @@ T.ProgressBar { x: (indeterminate ? offset * parent.width : 0) y: (parent.height - height) / 2 width: offset * (parent.width - x) - height: 6 + height: 4 color: control.Material.accentColor @@ -94,7 +94,7 @@ T.ProgressBar { x: control.leftPadding y: control.topPadding + (control.availableHeight - height) / 2 width: control.availableWidth - height: 6 + height: 4 color: Qt.rgba(control.Material.accentColor.r, control.Material.accentColor.g, control.Material.accentColor.b, 0.25) } -- cgit v1.2.3 From 14b41264a1c3770e98d2ff075ba8bbe6cda2f841 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 7 Jan 2016 13:35:30 +0100 Subject: ApplicationWindow: don't delete old headers and footers Change-Id: I6df97edff6f034d79cbd95828a17d5f48dbf1d46 Task-number: QTBUG-50332 Reviewed-by: Mitch Curtis --- src/templates/qquickapplicationwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/templates/qquickapplicationwindow.cpp b/src/templates/qquickapplicationwindow.cpp index 46f07d3e..3e6734d7 100644 --- a/src/templates/qquickapplicationwindow.cpp +++ b/src/templates/qquickapplicationwindow.cpp @@ -240,7 +240,8 @@ void QQuickApplicationWindow::setHeader(QQuickItem *header) { Q_D(QQuickApplicationWindow); if (d->header != header) { - delete d->header; + if (d->header) + QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight); d->header = header; if (header) { header->setParentItem(contentItem()); @@ -273,7 +274,8 @@ void QQuickApplicationWindow::setFooter(QQuickItem *footer) { Q_D(QQuickApplicationWindow); if (d->footer != footer) { - delete d->footer; + if (d->footer) + QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight); d->footer = footer; if (footer) { footer->setParentItem(contentItem()); -- cgit v1.2.3 From ad2193f66b942d138c183992af2ec76fc66aa7a5 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 7 Jan 2016 19:10:18 +0100 Subject: Material style: hide implementation details Change-Id: Ib797d34014c5faddc05e93f6fc5c4f95c5664997 Reviewed-by: Mitch Curtis --- src/imports/controls/material/BusyIndicator.qml | 1 + src/imports/controls/material/qtlabsmaterialstyleplugin.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/imports/controls/material/BusyIndicator.qml b/src/imports/controls/material/BusyIndicator.qml index 6d5e4e8d..9eb48613 100644 --- a/src/imports/controls/material/BusyIndicator.qml +++ b/src/imports/controls/material/BusyIndicator.qml @@ -37,6 +37,7 @@ import QtQuick 2.6 import Qt.labs.templates 1.0 as T import Qt.labs.controls.material 1.0 +import Qt.labs.controls.material.impl 1.0 T.BusyIndicator { id: control diff --git a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp index db8b47ee..975e5db6 100644 --- a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp +++ b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp @@ -76,8 +76,6 @@ QtLabsMaterialStylePlugin::~QtLabsMaterialStylePlugin() void QtLabsMaterialStylePlugin::registerTypes(const char *uri) { qmlRegisterUncreatableType(uri, 1, 0, "Material", tr("Material is an attached property")); - qmlRegisterType(uri, 1, 0, "ProgressRing"); - qmlRegisterType(uri, 1, 0, "RingAnimator"); } void QtLabsMaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri) @@ -97,6 +95,10 @@ void QtLabsMaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char } initResources(); + + QByteArray import = QByteArray(uri) + ".impl"; + qmlRegisterType(import, 1, 0, "ProgressRing"); + qmlRegisterType(import, 1, 0, "RingAnimator"); } QT_END_NAMESPACE -- cgit v1.2.3 From 476f7944d24657055db6384f11eacf7589687f76 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 8 Jan 2016 16:47:14 +0100 Subject: Don't skip test_indeterminate now that the bug is fixed Change-Id: If8810ae39fbfefdbf381a5fdefb25974f1f3925c Reviewed-by: J-P Nurmi --- tests/auto/controls/data/tst_progressbar.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/controls/data/tst_progressbar.qml b/tests/auto/controls/data/tst_progressbar.qml index 086d9ad4..1aea09f5 100644 --- a/tests/auto/controls/data/tst_progressbar.qml +++ b/tests/auto/controls/data/tst_progressbar.qml @@ -183,7 +183,6 @@ TestCase { } function test_indeterminate() { - skip("skipping until https://codereview.qt-project.org/#/c/145140/ is merged") var control = progressBar.createObject(testCase) verify(control) compare(control.indeterminate, false) -- cgit v1.2.3 From a3dddf0471452448003cfe6c6802e3ccaf565b5d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 7 Jan 2016 15:52:08 +0100 Subject: Fix style inheritance for popups Change-Id: I7bc36cb68e8d668fff2270e018de7eb1c71ccd20 Task-number: QTBUG-50347 Reviewed-by: Mitch Curtis --- src/controls/controls.pro | 2 +- src/controls/qquickstyle.cpp | 68 ++++++++++++++++------------ src/imports/controls/material/material.pro | 2 +- src/imports/controls/universal/universal.pro | 2 +- src/src.pro | 1 + tests/auto/material/data/tst_material.qml | 28 ++++++++++++ tests/auto/universal/data/tst_universal.qml | 28 ++++++++++++ 7 files changed, 99 insertions(+), 32 deletions(-) diff --git a/src/controls/controls.pro b/src/controls/controls.pro index ecb3a9d6..cb9a8683 100644 --- a/src/controls/controls.pro +++ b/src/controls/controls.pro @@ -3,7 +3,7 @@ MODULE = labscontrols CONFIG += static internal_module QT += quick -QT_PRIVATE += core-private gui-private qml-private quick-private +QT_PRIVATE += core-private gui-private qml-private quick-private labstemplates-private DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII diff --git a/src/controls/qquickstyle.cpp b/src/controls/qquickstyle.cpp index 5e1085c6..58563954 100644 --- a/src/controls/qquickstyle.cpp +++ b/src/controls/qquickstyle.cpp @@ -40,6 +40,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -53,42 +54,33 @@ static QQuickStyle *attachedStyle(const QMetaObject *type, QObject *object, bool return qobject_cast(qmlAttachedPropertiesObject(&idx, object, type, create)); } -static QQuickStyle *findParentStyle(const QMetaObject *type, QObject *object) +static QQuickStyle *findParentStyle(const QMetaObject *type, QObject *parent) { - QQuickItem *item = qobject_cast(object); + if (!parent) + return Q_NULLPTR; + + QQuickStyle *style = attachedStyle(type, parent); + if (style) + return style; + + QQuickItem *item = qobject_cast(parent); if (item) { // lookup parent items QQuickItem *parent = item->parentItem(); - while (parent) { - QQuickStyle *style = attachedStyle(type, parent); - if (style) - return style; - parent = parent->parentItem(); - } + if (parent) + return findParentStyle(type, parent); // fallback to item's window - QQuickWindow *window = item->window(); - if (window) { - QQuickStyle *style = attachedStyle(type, window); - if (style) - return style; - } + return findParentStyle(type, item->window()); } - // lookup parent window - QQuickWindow *window = qobject_cast(object); - if (window) { - QQuickWindow *parentWindow = qobject_cast(window->parent()); - if (parentWindow) { - QQuickStyle *style = attachedStyle(type, window); - if (style) - return style; - } - } + // lookup object parent (window/popup) + if (parent->parent()) + return findParentStyle(type, parent->parent()); // fallback to engine (global) - if (object) { - QQmlEngine *engine = qmlEngine(object); + if (parent) { + QQmlEngine *engine = qmlEngine(parent); if (engine) { QByteArray name = QByteArray("_q_") + type->className(); QQuickStyle *style = engine->property(name).value(); @@ -109,8 +101,7 @@ static QList findChildStyles(const QMetaObject *type, QObject *ob QQuickItem *item = qobject_cast(object); if (!item) { - QQuickWindow *window = qobject_cast(object); - if (window) { + if (QQuickWindow *window = qobject_cast(object)) { item = window->contentItem(); foreach (QObject *child, window->children()) { @@ -121,6 +112,12 @@ static QList findChildStyles(const QMetaObject *type, QObject *ob children += style; } } + } else if (QQuickPopup *popup = qobject_cast(object)) { + item = popup->contentItem(); + + QQuickStyle *style = attachedStyle(type, popup); + if (style) + children += style; } } @@ -132,6 +129,16 @@ static QList findChildStyles(const QMetaObject *type, QObject *ob else children += findChildStyles(type, child); } + + foreach (QObject *child, item->children()) { + if (!qobject_cast(child)) { + QQuickStyle *style = attachedStyle(type, child); + if (style) + children += style; + else + children += findChildStyles(type, child); + } + } } return children; @@ -193,7 +200,10 @@ void QQuickStyle::setParentStyle(QQuickStyle *style) void QQuickStyle::init() { - QQuickStyle *parentStyle = findParentStyle(metaObject(), parent()); + if (!parent()) + return; + + QQuickStyle *parentStyle = findParentStyle(metaObject(), parent()->parent()); if (parentStyle) setParentStyle(parentStyle); diff --git a/src/imports/controls/material/material.pro b/src/imports/controls/material/material.pro index 06b9ed7d..63450289 100644 --- a/src/imports/controls/material/material.pro +++ b/src/imports/controls/material/material.pro @@ -3,7 +3,7 @@ TARGETPATH = Qt/labs/controls/material IMPORT_VERSION = 1.0 QT += qml quick -QT_PRIVATE += core-private gui-private qml-private quick-private labscontrols-private +QT_PRIVATE += core-private gui-private qml-private quick-private labstemplates-private labscontrols-private DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII diff --git a/src/imports/controls/universal/universal.pro b/src/imports/controls/universal/universal.pro index 41cef97d..88bad8f7 100644 --- a/src/imports/controls/universal/universal.pro +++ b/src/imports/controls/universal/universal.pro @@ -3,7 +3,7 @@ TARGETPATH = Qt/labs/controls/universal IMPORT_VERSION = 1.0 QT += qml quick -QT_PRIVATE += core-private gui-private qml-private quick-private labscontrols-private +QT_PRIVATE += core-private gui-private qml-private quick-private labstemplates-private labscontrols-private DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII diff --git a/src/src.pro b/src/src.pro index 1492f15e..38778fe1 100644 --- a/src/src.pro +++ b/src/src.pro @@ -4,4 +4,5 @@ SUBDIRS += \ controls \ imports +controls.depends = templates imports.depends = controls templates diff --git a/tests/auto/material/data/tst_material.qml b/tests/auto/material/data/tst_material.qml index 7797b8c3..5fc52f10 100644 --- a/tests/auto/material/data/tst_material.qml +++ b/tests/auto/material/data/tst_material.qml @@ -94,6 +94,19 @@ TestCase { } } + Component { + id: menu + Item { + Material.accent: Material.Red + property alias menu: popup + Menu { + id: popup + Material.theme: Material.Dark + MenuItem { } + } + } + } + function test_defaults() { var control = button.createObject(testCase) verify(control) @@ -222,4 +235,19 @@ TestCase { compare(child.Material.theme, Material.Dark) control.destroy() } + + function test_menu() { + var container = menu.createObject(testCase) + verify(container) + verify(container.menu) + var child = container.menu.itemAt(0) + verify(child) + compare(container.Material.theme, Material.Light) + compare(container.menu.Material.theme, Material.Dark) + compare(child.Material.theme, Material.Dark) + compare(container.Material.accent, Material.Red) + compare(container.menu.Material.accent, Material.Red) + compare(child.Material.accent, Material.Red) + container.destroy() + } } diff --git a/tests/auto/universal/data/tst_universal.qml b/tests/auto/universal/data/tst_universal.qml index 5c29f33c..6e70f011 100644 --- a/tests/auto/universal/data/tst_universal.qml +++ b/tests/auto/universal/data/tst_universal.qml @@ -94,6 +94,19 @@ TestCase { } } + Component { + id: menu + Item { + Universal.accent: Universal.Red + property alias menu: popup + Menu { + id: popup + Universal.theme: Universal.Dark + MenuItem { } + } + } + } + function test_defaults() { var control = button.createObject(testCase) verify(control) @@ -223,6 +236,21 @@ TestCase { control.destroy() } + function test_menu() { + var container = menu.createObject(testCase) + verify(container) + verify(container.menu) + var child = container.menu.itemAt(0) + verify(child) + compare(container.Universal.theme, Universal.Light) + compare(container.menu.Universal.theme, Universal.Dark) + compare(child.Universal.theme, Universal.Dark) + compare(container.Universal.accent, "#e51400") // Red + compare(container.menu.Universal.accent, "#e51400") // Red + compare(child.Universal.accent, "#e51400") // Red + container.destroy() + } + function test_colors() { var control = button.createObject(testCase) verify(control) -- cgit v1.2.3