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);
24
25 if (currentParent)
26 currentParent->m_childStack.pushWindow(window, positionPreference);
27}
28
29template<class Window>
31{
32 return nullptr;
33}
34
35template<class Window>
37{
38 window->setZOrder(z);
39}
40
41template<class Window>
43 typename QWasmWindowStack<Window>::PositionPreference positionPreference)
44{
45 if (parentNode()) {
46 parentNode()->m_childStack.windowPositionPreferenceChanged(asWasmWindow(),
47 positionPreference);
48 }
49}
50
51template<class Window>
53{
54 if (parentNode())
55 parentNode()->setActiveChildNode(asWasmWindow());
56
57 // At the end, this is a recursive function
58 m_activeIndex = ++s_nextActiveIndex;
59}
60
61template<class Window>
63{
64 if (!parentNode())
65 return;
66 parentNode()->m_childStack.raise(asWasmWindow());
67 parentNode()->bringToTop();
68}
69
70template<class Window>
72{
73 if (!parentNode())
74 return;
75 parentNode()->m_childStack.lower(asWasmWindow());
76}
77
78template<class Window>
79void QWasmWindowTreeNode<Window>::onTopWindowChanged()
80{
81 constexpr int zOrderForElementInFrontOfScreen = 3;
82 int z = zOrderForElementInFrontOfScreen;
83 std::for_each(m_childStack.rbegin(), m_childStack.rend(),
84 [this, &z](Window *window) { setWindowZOrder(window, z++); });
85}
86
87template<class Window>
88void QWasmWindowTreeNode<Window>::setActiveChildNode(Window *activeChild)
89{
90 for (auto *child : m_childStack)
91 child->onActivationChanged(child == activeChild);
92
93 setAsActiveNode();
94}
95
96#endif /* QWASMWINDOWTREENODE_INC */
virtual void setWindowZOrder(Window *window, int z)
void onPositionPreferenceChanged(typename QWasmWindowStack< Window >::PositionPreference positionPreference)
virtual Window * asWasmWindow()
virtual ~QWasmWindowTreeNode()
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
QLayoutItem * child
[0]
socketLayer bind(QHostAddress::Any, 4000)