transientParent property for Dialog

use it when a Dialog instance is a popup menu of another dialog
This commit is contained in:
Marco Martin 2014-02-24 13:52:24 +01:00
parent 48cc5e9fcd
commit ef879a7c7b
2 changed files with 18 additions and 0 deletions

View File

@ -679,6 +679,16 @@ void DialogProxy::updateInputShape()
#endif
}
void DialogProxy::setTransientParentAndNotify(QWindow *parent)
{
if (parent == transientParent()) {
return;
}
setTransientParent(parent);
emit transientParentChanged();
}
//find the screen which contains the item
QScreen* DialogProxy::screenForItem(QQuickItem* item) const

View File

@ -76,6 +76,11 @@ class DialogProxy : public QQuickWindow, public QQmlParserStatus
*/
Q_PROPERTY(WindowType type READ type WRITE setType NOTIFY typeChanged)
/**
* This is a hint to the window manager that this window is a dialog or pop-up on behalf of the given window.
*/
Q_PROPERTY(QWindow *transientParent READ transientParent WRITE setTransientParentAndNotify NOTIFY transientParentChanged)
/**
* Whether the dialog should be hidden when the dialog loses focus.
*
@ -141,6 +146,8 @@ public:
bool isOutputOnly() const;
void updateInputShape();
void setTransientParentAndNotify(QWindow *parent);
Q_SIGNALS:
void mainItemChanged();
void locationChanged();
@ -148,6 +155,7 @@ Q_SIGNALS:
void typeChanged();
void hideOnWindowDeactivateChanged();
void outputOnlyChanged();
void transientParentChanged();
public Q_SLOTS:
void syncMainItemToSize();