Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwasmwindowtreenode.inc
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWASMWINDOWTREENODE_INC
5#define QWASMWINDOWTREENODE_INC
6
7template<class Window>
9 : m_childStack(std::bind(&QWasmWindowTreeNode<Window>::onTopWindowChanged, this))
10{
11}
12
13template<class Window>
15
16template<class Window>
18 QWasmWindowTreeNode *currentParent,
19 typename QWasmWindowStack<Window>::PositionPreference positionPreference)
20{
21 auto *window = asWasmWindow();
22 if (previousParent) {
23 previousParent->m_childStack.removeWindow(window);
25 window);
26 }
27
28 if (currentParent) {
29 currentParent->m_childStack.pushWindow(window, positionPreference);
31 window);
32 }
33}
34
35template<class Window>
37{
38 return nullptr;
39}
40
41template<class Window>
44{
45 if (parentNode())
46 parentNode()->onSubtreeChanged(changeType, parent, child);
47}
48
49template<class Window>
51{
52 window->setZOrder(z);
53}
54
55template<class Window>
57 typename QWasmWindowStack<Window>::PositionPreference positionPreference)
58{
59 if (parentNode()) {
60 parentNode()->m_childStack.windowPositionPreferenceChanged(asWasmWindow(),
61 positionPreference);
62 }
63}
64
65template<class Window>
67{
68 if (parentNode())
69 parentNode()->setActiveChildNode(asWasmWindow());
70
71 // At the end, this is a recursive function
72 m_activeIndex = ++s_nextActiveIndex;
73}
74
75template<class Window>
77{
78 if (!parentNode())
79 return;
80 parentNode()->m_childStack.raise(asWasmWindow());
81 parentNode()->bringToTop();
82}
83
84template<class Window>
86{
87 if (!parentNode())
88 return;
89 parentNode()->m_childStack.lower(asWasmWindow());
90}
91
92template<class Window>
93void QWasmWindowTreeNode<Window>::onTopWindowChanged()
94{
95 constexpr int zOrderForElementInFrontOfScreen = 3;
96 int z = zOrderForElementInFrontOfScreen;
97 std::for_each(m_childStack.rbegin(), m_childStack.rend(),
98 [this, &z](Window *window) { setWindowZOrder(window, z++); });
99}
100
101template<class Window>
102void QWasmWindowTreeNode<Window>::setActiveChildNode(Window *activeChild)
103{
104 m_activeChild = activeChild;
105
106 auto it = m_childStack.begin();
107 if (it == m_childStack.end())
108 return;
109 for (; it != m_childStack.end(); ++it)
110 (*it)->onActivationChanged(*it == m_activeChild);
111
112 setAsActiveNode();
113}
114
115#endif /* QWASMWINDOWTREENODE_INC */
virtual void setWindowZOrder(Window *window, int z)
void onPositionPreferenceChanged(typename QWasmWindowStack< Window >::PositionPreference positionPreference)
virtual Window * asWasmWindow()
virtual ~QWasmWindowTreeNode()
virtual void onSubtreeChanged(QWasmWindowTreeNodeChangeType changeType, QWasmWindowTreeNode *parent, Window *child)
virtual void onParentChanged(QWasmWindowTreeNode *previous, QWasmWindowTreeNode *current, typename QWasmWindowStack< Window >::PositionPreference positionPreference)
[Window class with invokable method]
Definition window.h:11
#define this
Definition dialogs.cpp:8
self window
[2]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
QWasmWindowTreeNodeChangeType
QLayoutItem * child
[0]
socketLayer bind(QHostAddress::Any, 4000)
QJSValueIterator it(object)