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
qwaylandqtshellchrome.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QWAYLANDQTSHELLCHROME_H
6#define QWAYLANDQTSHELLCHROME_H
7
8#include <QtQuick/qquickitem.h>
9#include <QtWaylandCompositor/qwaylandquickshellsurfaceitem.h>
10
12
14class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtShellChrome : public QQuickItem
15{
16 Q_OBJECT
17 QML_NAMED_ELEMENT(QtShellChrome)
18 QML_ADDED_IN_VERSION(1, 0)
19 Q_DECLARE_PRIVATE(QWaylandQtShellChrome)
20 Q_PROPERTY(bool hasDecorations READ hasDecorations NOTIFY windowMetaInfoChanged)
21 Q_PROPERTY(uint windowState READ currentWindowState NOTIFY currentWindowStateChanged)
22 Q_PROPERTY(uint windowFlags READ currentWindowFlags NOTIFY currentWindowFlagsChanged)
23 Q_PROPERTY(QWaylandQuickShellSurfaceItem *shellSurfaceItem READ shellSurfaceItem WRITE setShellSurfaceItem NOTIFY shellSurfaceItemChanged)
24 Q_PROPERTY(QRect maximizedRect READ maximizedRect WRITE setMaximizedRect NOTIFY maximizedRectChanged)
25
26 Q_PROPERTY(int frameMarginLeft READ frameMarginLeft WRITE setFrameMarginLeft NOTIFY frameMarginChanged)
27 Q_PROPERTY(int frameMarginRight READ frameMarginRight WRITE setFrameMarginRight NOTIFY frameMarginChanged)
28 Q_PROPERTY(int frameMarginTop READ frameMarginTop WRITE setFrameMarginTop NOTIFY frameMarginChanged)
29 Q_PROPERTY(int frameMarginBottom READ frameMarginBottom WRITE setFrameMarginBottom NOTIFY frameMarginChanged)
30
31 Q_PROPERTY(QQuickItem *titleBar READ titleBar WRITE setTitleBar NOTIFY titleBarChanged);
32 Q_PROPERTY(QQuickItem *leftResizeHandle READ leftResizeHandle WRITE setLeftResizeHandle NOTIFY leftResizeHandleChanged);
33 Q_PROPERTY(QQuickItem *rightResizeHandle READ rightResizeHandle WRITE setRightResizeHandle NOTIFY rightResizeHandleChanged);
34 Q_PROPERTY(QQuickItem *topResizeHandle READ topResizeHandle WRITE setTopResizeHandle NOTIFY topResizeHandleChanged);
35 Q_PROPERTY(QQuickItem *bottomResizeHandle READ bottomResizeHandle WRITE setBottomResizeHandle NOTIFY bottomResizeHandleChanged);
36 Q_PROPERTY(QQuickItem *topLeftResizeHandle READ topLeftResizeHandle WRITE setTopLeftResizeHandle NOTIFY topLeftResizeHandleChanged);
37 Q_PROPERTY(QQuickItem *topRightResizeHandle READ topRightResizeHandle WRITE setTopRightResizeHandle NOTIFY topRightResizeHandleChanged);
38 Q_PROPERTY(QQuickItem *bottomLeftResizeHandle READ bottomLeftResizeHandle WRITE setBottomLeftResizeHandle NOTIFY bottomLeftResizeHandleChanged);
39 Q_PROPERTY(QQuickItem *bottomRightResizeHandle READ bottomRightResizeHandle WRITE setBottomRightResizeHandle NOTIFY bottomRightResizeHandleChanged);
40public:
41 QWaylandQtShellChrome(QQuickItem *parent = nullptr);
42 ~QWaylandQtShellChrome() override;
43
44 bool hasTitleBar() const;
45 bool hasDecorations() const;
46 uint currentWindowState() const;
47 uint currentWindowFlags() const;
48
49 void setMaximizedRect(const QRect &rect);
50 QRect maximizedRect() const;
51
52 void setShellSurfaceItem(QWaylandQuickShellSurfaceItem *shellSurfaceItem);
53 QWaylandQuickShellSurfaceItem *shellSurfaceItem() const;
54
55 void setTitleBar(QQuickItem *item);
56 QQuickItem *titleBar() const;
57
58 void setLeftResizeHandle(QQuickItem *item);
59 QQuickItem *leftResizeHandle() const;
60
61 void setRightResizeHandle(QQuickItem *item);
62 QQuickItem *rightResizeHandle() const;
63
64 void setTopResizeHandle(QQuickItem *item);
65 QQuickItem *topResizeHandle() const;
66
67 void setBottomResizeHandle(QQuickItem *item);
68 QQuickItem *bottomResizeHandle() const;
69
70 void setTopLeftResizeHandle(QQuickItem *item);
71 QQuickItem *topLeftResizeHandle() const;
72
73 void setBottomLeftResizeHandle(QQuickItem *item);
74 QQuickItem *bottomLeftResizeHandle() const;
75
76 void setTopRightResizeHandle(QQuickItem *item);
77 QQuickItem *topRightResizeHandle() const;
78
79 void setBottomRightResizeHandle(QQuickItem *item);
80 QQuickItem *bottomRightResizeHandle() const;
81
82 int frameMarginLeft() const;
83 void setFrameMarginLeft(int left);
84
85 int frameMarginRight() const;
86 void setFrameMarginRight(int right);
87
88 int frameMarginTop() const;
89 void setFrameMarginTop(int top);
90
91 int frameMarginBottom() const;
92 void setFrameMarginBottom(int bottom);
93
94Q_SIGNALS:
95 void currentWindowStateChanged();
96 void currentWindowFlagsChanged();
97 void windowMetaInfoChanged();
98 void shellSurfaceItemChanged();
99 void maximizedRectChanged();
100
101 void titleBarChanged();
102 void leftResizeHandleChanged();
103 void rightResizeHandleChanged();
104 void topResizeHandleChanged();
105 void bottomResizeHandleChanged();
106 void topLeftResizeHandleChanged();
107 void bottomLeftResizeHandleChanged();
108 void topRightResizeHandleChanged();
109 void bottomRightResizeHandleChanged();
110
111 void activated();
112 void deactivated();
113
114 void clientDestroyed();
115 void frameMarginChanged();
116
117public Q_SLOTS:
118 void raise();
119 void lower();
120 void toggleMaximized();
121 void toggleMinimized();
122 void toggleFullScreen();
123 void activate();
124 void deactivate();
125
126private Q_SLOTS:
127 void activateOnGrab(QPointingDevice::GrabTransition transition);
128 void updateSurface();
129 void updateShellSurface();
130 void updateWindowFlags();
131 void updateWindowState();
132 void updateGeometry();
133 void updateDecorations();
134 void updateActiveState();
135 void updateAutomaticPosition();
136 void stopGrab();
137 void leftResize();
138 void rightResize();
139 void topResize();
140 void bottomResize();
141 void topLeftResize();
142 void topRightResize();
143 void bottomLeftResize();
144 void bottomRightResize();
145 void titleBarMove();
146
147protected:
148 QWaylandQtShellChrome(QWaylandQtShellChromePrivate &dd, QQuickItem *parent);
149
150private:
151 void setWindowState(uint nextState);
152 void init();
153 QRect maxContentRect() const;
154};
155
156QT_END_NAMESPACE
157
158#endif // QWAYLANDQTSHELLSURFACEITEM_H
\inmodule QtWaylandCompositor
Combined button and popup list for selecting options.