summaryrefslogtreecommitdiffstats
path: root/src/webengine/ui_delegates_manager.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-06-17 10:54:16 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-06-17 10:54:16 +0200
commit807adfeec9f9dadb651e401b7dd69eeccda4dd7a (patch)
tree98790b3b20d4a49a6ce359ff4baa2f1934cba16e /src/webengine/ui_delegates_manager.cpp
parent1e52779f3c287d82820c91ddb0e9f666eef9054a (diff)
parent528088cb61eaacb63e87ea8e06f59d1536e43799 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Diffstat (limited to 'src/webengine/ui_delegates_manager.cpp')
-rw-r--r--src/webengine/ui_delegates_manager.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index a82ed0f2e..6ff12b53f 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -209,7 +209,7 @@ void UIDelegatesManager::addMenuSeparator(QObject *menu)
QObject *UIDelegatesManager::addMenu(QObject *parentMenu, const QString &title, const QPoint& pos)
{
-
+ Q_ASSERT(parentMenu);
if (!ensureComponentLoaded(Menu))
return 0;
QQmlContext *context = qmlContext(m_view);
@@ -222,18 +222,18 @@ QObject *UIDelegatesManager::addMenu(QObject *parentMenu, const QString &title,
QQmlProperty(menu, QStringLiteral("title")).write(title);
if (!pos.isNull())
QQmlProperty(menu, QStringLiteral("pos")).write(pos);
- if (!parentMenu) {
- QQmlProperty doneSignal(menu, QStringLiteral("onDone"));
- static int deleteLaterIndex = menu->metaObject()->indexOfSlot("deleteLater()");
- if (doneSignal.isSignalProperty())
- QObject::connect(menu, doneSignal.method(), menu, menu->metaObject()->method(deleteLaterIndex));
- } else {
- menu->setParent(parentMenu);
- QQmlListReference entries(parentMenu, defaultPropertyName(parentMenu), qmlEngine(m_view));
- if (entries.isValid())
- entries.append(menu);
- }
+ menu->setParent(parentMenu);
+
+ QQmlProperty doneSignal(menu, QStringLiteral("onDone"));
+ static int deleteLaterIndex = menu->metaObject()->indexOfSlot("deleteLater()");
+ CHECK_QML_SIGNAL_PROPERTY(doneSignal, menuComponent->url());
+ QObject::connect(menu, doneSignal.method(), menu, menu->metaObject()->method(deleteLaterIndex));
+
+ QQmlListReference entries(parentMenu, defaultPropertyName(parentMenu), qmlEngine(m_view));
+ if (entries.isValid())
+ entries.append(menu);
+
menuComponent->completeCreate();
return menu;
}
@@ -401,9 +401,12 @@ void UIDelegatesManager::showDialog(QSharedPointer<AuthenticationDialogControlle
CHECK_QML_SIGNAL_PROPERTY(rejectSignal, authenticationDialogComponent->url());
static int acceptIndex = dialogController->metaObject()->indexOfSlot("accept(QString,QString)");
+ static int deleteLaterIndex = authenticationDialog->metaObject()->indexOfSlot("deleteLater()");
QObject::connect(authenticationDialog, acceptSignal.method(), dialogController.data(), dialogController->metaObject()->method(acceptIndex));
+ QObject::connect(authenticationDialog, acceptSignal.method(), authenticationDialog, authenticationDialog->metaObject()->method(deleteLaterIndex));
static int rejectIndex = dialogController->metaObject()->indexOfSlot("reject()");
QObject::connect(authenticationDialog, rejectSignal.method(), dialogController.data(), dialogController->metaObject()->method(rejectIndex));
+ QObject::connect(authenticationDialog, rejectSignal.method(), authenticationDialog, authenticationDialog->metaObject()->method(deleteLaterIndex));
authenticationDialogComponent->completeCreate();
QMetaObject::invokeMethod(authenticationDialog, "open");