summaryrefslogtreecommitdiff
path: root/src/controls/Private/EditMenu.qml
diff options
context:
space:
mode:
authorMarco Martin <mart@kde.org>2015-09-10 16:43:14 +0200
committerMarco Martin <mart@kde.org>2015-09-11 10:37:29 +0000
commit1a34c7f18f54d2b5397dad247cc2c08674322a93 (patch)
treeceec6b41836f500392fb40fe06558d7e21e23d76 /src/controls/Private/EditMenu.qml
parente74e3fb1f010b00240d4cbdfe6025725449baf06 (diff)
downloadqtquickcontrols-1a34c7f18f54d2b5397dad247cc2c08674322a93.tar.gz
Manage the case when __style doesn't exist yet at onCompleted
since __style gets instantiated by a loader, we are not sure that when Component.onCompleted is triggered, __style will be already there. manage separately the case when __style will be instantiated right after the component is complete. Change-Id: I23418138881904b10741159835e7f825363bc022 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Diffstat (limited to 'src/controls/Private/EditMenu.qml')
-rw-r--r--src/controls/Private/EditMenu.qml14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/controls/Private/EditMenu.qml b/src/controls/Private/EditMenu.qml
index dc3ba64a..a70e8407 100644
--- a/src/controls/Private/EditMenu.qml
+++ b/src/controls/Private/EditMenu.qml
@@ -47,6 +47,7 @@ Loader {
property Component defaultMenu: item && item.defaultMenu ? item.defaultMenu : null
property QtObject menuInstance: null
property MouseArea mouseArea
+ property QtObject style: __style
Connections {
target: control
@@ -67,13 +68,18 @@ Loader {
return menuInstance;
}
- Component.onCompleted: {
- if (__style.__editMenu) {
- sourceComponent = __style.__editMenu;
- } else {
+ function syncStyle() {
+ if (!style)
+ return;
+
+ if (style.__editMenu)
+ sourceComponent = style.__editMenu;
+ else {
// todo: get ios/android/base menus from style as well
source = (Qt.resolvedUrl(Qt.platform.os === "ios" ? "EditMenu_ios.qml"
: Qt.platform.os === "android" ? "" : "EditMenu_base.qml"));
}
}
+ onStyleChanged: syncStyle();
+ Component.onCompleted: syncStyle();
}