diff --git a/src/declarativeimports/core/dialog.cpp b/src/declarativeimports/core/dialog.cpp index b353caf02..db3c67e8c 100644 --- a/src/declarativeimports/core/dialog.cpp +++ b/src/declarativeimports/core/dialog.cpp @@ -54,7 +54,8 @@ DialogProxy::DialogProxy(QQuickItem *parent) m_location(Plasma::Types::BottomEdge), m_type(Normal), m_hideOnWindowDeactivate(false), - m_outputOnly(false) + m_outputOnly(false), + m_componentComplete(false) { QSurfaceFormat format; format.setAlphaBufferSize(8); @@ -453,6 +454,10 @@ void DialogProxy::syncToMainItemSize() void DialogProxy::requestSyncToMainItemSize(bool delayed) { + if (!m_componentComplete) { + return; + } + if (delayed && !m_syncTimer->isActive()) { m_syncTimer->start(150); } else { @@ -524,6 +529,17 @@ void DialogProxy::hideEvent(QHideEvent *event) QQuickWindow::hideEvent(event); } +void DialogProxy::classBegin() +{ + +} + +void DialogProxy::componentComplete() +{ + m_componentComplete = true; + syncToMainItemSize(); +} + void DialogProxy::syncBorders() { // FIXME: QWindow::screen() never ever changes if the window is moved across diff --git a/src/declarativeimports/core/dialog.h b/src/declarativeimports/core/dialog.h index 3c0df8b71..a4cd427f9 100644 --- a/src/declarativeimports/core/dialog.h +++ b/src/declarativeimports/core/dialog.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -44,9 +45,10 @@ namespace Plasma * * Exposed as `PlasmaCore.Dialog` in QML. */ -class DialogProxy : public QQuickWindow +class DialogProxy : public QQuickWindow, public QQmlParserStatus { Q_OBJECT + Q_INTERFACES(QQmlParserStatus) /** * The main QML item that will be displayed in the Dialog @@ -161,6 +163,9 @@ protected: void hideEvent(QHideEvent *event); bool event(QEvent *event); + virtual void classBegin(); + virtual void componentComplete(); + QTimer *m_syncTimer; Plasma::Types::Location m_location; Plasma::FrameSvgItem *m_frameSvgItem; @@ -185,6 +190,7 @@ private: bool m_hideOnWindowDeactivate; bool m_outputOnly; Plasma::Theme m_theme; + bool m_componentComplete; //Attached Layout property of mainItem, if any QWeakPointer m_mainItemLayout;