diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-11-24 16:09:39 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-12-08 15:57:18 +0000 |
commit | 7a93d98f29fca9f1610f3b61b055535916903500 (patch) | |
tree | 9dd8bee59e0a1a308228edc01b6d642186936cc5 /src/gui/kernel/qwindow.h | |
parent | 6604d79a21fcdd23f7f58055299aa1ab914eb734 (diff) |
Add QWindow::AncestorMode overload of QWindow::parent()
Simplifies code that traverses the parent hierarchy, including transient
parents. For Qt6 we should merge the two parent() functions, adding a
default value for the mode, probably ExcludeTransients.
Change-Id: Ic9cdae3e31a3a8e140a5b175160f3b934d2b6e00
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindow.h')
-rw-r--r-- | src/gui/kernel/qwindow.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 0b84f30468..2883749d2e 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -132,6 +132,12 @@ public: }; Q_ENUM(Visibility) + enum AncestorMode { + ExcludeTransients, + IncludeTransients + }; + Q_ENUM(AncestorMode) + explicit QWindow(QScreen *screen = Q_NULLPTR); explicit QWindow(QWindow *parent); virtual ~QWindow(); @@ -148,7 +154,8 @@ public: WId winId() const; - QWindow *parent() const; + QWindow *parent(AncestorMode mode) const; + QWindow *parent() const; // ### Qt6: Merge with above void setParent(QWindow *parent); bool isTopLevel() const; @@ -187,11 +194,6 @@ public: void setTransientParent(QWindow *parent); QWindow *transientParent() const; - enum AncestorMode { - ExcludeTransients, - IncludeTransients - }; - bool isAncestorOf(const QWindow *child, AncestorMode mode = IncludeTransients) const; bool isExposed() const; |