Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwasmwindowstack.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWASMWINDOWSTACK_H
5#define QWASMWINDOWSTACK_H
6
7#include <qglobal.h>
8#include <QtCore/qlist.h>
9
10#include <vector>
11
13
14class QWasmWindow;
15
16// Maintains a z-order hierarchy for a set of windows. The first added window is always treated as
17// the 'root', which always stays at the bottom. Other windows are 'regular', which means they are
18// subject to z-order changes via |raise| and |lower|/
19// If the root is ever removed, all of the current and future windows in the stack are treated as
20// regular.
21// Access to the top element is facilitated by |topWindow|.
22// Changes to the top element are signaled via the |topWindowChangedCallback| supplied at
23// construction.
25{
26public:
27 using WindowOrderChangedCallbackType = std::function<void()>;
28
29 using StorageType = QList<QWasmWindow *>;
30
33 using const_reverse_iterator = StorageType::const_iterator;
34
35 enum class PositionPreference {
36 StayOnBottom,
37 Regular,
38 StayOnTop,
39 };
40
41 explicit QWasmWindowStack(WindowOrderChangedCallbackType topWindowChangedCallback);
43
45 void removeWindow(QWasmWindow *window);
46 void raise(QWasmWindow *window);
47 void lower(QWasmWindow *window);
48 void windowPositionPreferenceChanged(QWasmWindow *window, PositionPreference position);
49
50 // Iterates top-to-bottom
52 iterator end();
53 const_iterator begin() const;
54 const_iterator end() const;
55
56 // Iterates bottom-to-top
57 const_reverse_iterator rbegin() const;
58 const_reverse_iterator rend() const;
59
60 bool empty() const;
61 size_t size() const;
62 QWasmWindow *topWindow() const;
63
64private:
65 PositionPreference getWindowPositionPreference(StorageType::iterator windowIt) const;
66
67 WindowOrderChangedCallbackType m_windowOrderChangedCallback;
68 QList<QWasmWindow *> m_windowStack;
69 StorageType::iterator m_regularWindowsBegin;
70 StorageType::iterator m_alwaysOnTopWindowsBegin;
71};
72
74
75#endif // QWASMWINDOWSTACK_H
std::reverse_iterator< iterator > reverse_iterator
Definition qlist.h:251
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition qlist.h:252
StorageType::reverse_iterator iterator
StorageType::const_reverse_iterator const_iterator
std::function< void()> WindowOrderChangedCallbackType
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLuint end
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
#define Q_AUTOTEST_EXPORT
aWidget window() -> setWindowTitle("New Window Title")
[2]