Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
7
template
<
class
Window>
8
QWasmWindowTreeNode<Window>::QWasmWindowTreeNode
()
9
: m_childStack(
std
::
bind
(&
QWasmWindowTreeNode
<
Window
>::onTopWindowChanged,
this
))
10
{
11
}
12
13
template
<
class
Window>
14
QWasmWindowTreeNode<Window>::~QWasmWindowTreeNode
() =
default
;
15
16
template
<
class
Window>
17
void
QWasmWindowTreeNode<Window>::onParentChanged
(
QWasmWindowTreeNode
*previousParent,
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
29
template
<
class
Window>
30
Window
*
QWasmWindowTreeNode<Window>::asWasmWindow
()
31
{
32
return
nullptr
;
33
}
34
35
template
<
class
Window>
36
void
QWasmWindowTreeNode<Window>::setWindowZOrder
(
Window
*
window
,
int
z
)
37
{
38
window
->setZOrder(
z
);
39
}
40
41
template
<
class
Window>
42
void
QWasmWindowTreeNode<Window>::onPositionPreferenceChanged
(
43
typename
QWasmWindowStack<Window>::PositionPreference
positionPreference)
44
{
45
if
(parentNode()) {
46
parentNode()->m_childStack.windowPositionPreferenceChanged(asWasmWindow(),
47
positionPreference);
48
}
49
}
50
51
template
<
class
Window>
52
void
QWasmWindowTreeNode<Window>::setAsActiveNode
()
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
61
template
<
class
Window>
62
void
QWasmWindowTreeNode<Window>::bringToTop
()
63
{
64
if
(!parentNode())
65
return
;
66
parentNode()->m_childStack.raise(asWasmWindow());
67
parentNode()->bringToTop();
68
}
69
70
template
<
class
Window>
71
void
QWasmWindowTreeNode<Window>::sendToBottom
()
72
{
73
if
(!parentNode())
74
return
;
75
parentNode()->m_childStack.lower(asWasmWindow());
76
}
77
78
template
<
class
Window>
79
void
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
87
template
<
class
Window>
88
void
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 */
QWasmWindowStack::PositionPreference
PositionPreference
Definition
qwasmwindowstack.h:46
QWasmWindowTreeNode
Definition
qwasmwindowtreenode.h:26
QWasmWindowTreeNode::setWindowZOrder
virtual void setWindowZOrder(Window *window, int z)
QWasmWindowTreeNode::QWasmWindowTreeNode
QWasmWindowTreeNode()
QWasmWindowTreeNode::sendToBottom
void sendToBottom()
QWasmWindowTreeNode::onPositionPreferenceChanged
void onPositionPreferenceChanged(typename QWasmWindowStack< Window >::PositionPreference positionPreference)
QWasmWindowTreeNode::setAsActiveNode
void setAsActiveNode()
QWasmWindowTreeNode::bringToTop
void bringToTop()
QWasmWindowTreeNode::asWasmWindow
virtual Window * asWasmWindow()
QWasmWindowTreeNode::~QWasmWindowTreeNode
virtual ~QWasmWindowTreeNode()
QWasmWindowTreeNode::onParentChanged
virtual void onParentChanged(QWasmWindowTreeNode *previous, QWasmWindowTreeNode *current, typename QWasmWindowStack< Window >::PositionPreference positionPreference)
Window
[Window class with invokable method]
Definition
window.h:11
this
#define this
Definition
dialogs.cpp:8
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
window
self window
[2]
Definition
qcocoawindow.mm:59
z
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
Definition
qopengles2ext.h:2707
child
QLayoutItem * child
[0]
Definition
src_gui_kernel_qlayout.cpp:25
bind
socketLayer bind(QHostAddress::Any, 4000)
qtbase
src
plugins
platforms
wasm
qwasmwindowtreenode.inc
Generated on
for Qt by
1.18.0