QtBase  v6.3.1
qplatformwindow.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2017 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 #ifndef QPLATFORMWINDOW_H
40 #define QPLATFORMWINDOW_H
41 
42 //
43 // W A R N I N G
44 // -------------
45 //
46 // This file is part of the QPA API and is not meant to be used
47 // in applications. Usage of this API may make your code
48 // source and binary incompatible with future versions of Qt.
49 //
50 
51 #include <QtGui/qtguiglobal.h>
52 #include <QtCore/qscopedpointer.h>
53 #include <QtCore/qrect.h>
54 #include <QtCore/qmargins.h>
55 #include <QtCore/qstring.h>
56 #include <QtGui/qwindowdefs.h>
57 #include <QtGui/qwindow.h>
58 #include <qpa/qplatformopenglcontext.h>
59 #include <qpa/qplatformsurface.h>
60 
62 
63 #define QWINDOWSIZE_MAX ((1<<24)-1)
64 
65 class QPlatformScreen;
67 class QScreen;
68 class QWindow;
69 class QIcon;
70 class QRegion;
71 
72 class Q_GUI_EXPORT QPlatformWindow : public QPlatformSurface
73 {
74  Q_DECLARE_PRIVATE(QPlatformWindow)
75 public:
77 
78  explicit QPlatformWindow(QWindow *window);
79  ~QPlatformWindow() override;
80 
81  virtual void initialize();
82 
83  QWindow *window() const;
84  QPlatformWindow *parent() const;
85 
86  QPlatformScreen *screen() const override;
87 
88  virtual QSurfaceFormat format() const override;
89 
90  virtual void setGeometry(const QRect &rect);
91  virtual QRect geometry() const;
92  virtual QRect normalGeometry() const;
93 
94  virtual QMargins frameMargins() const;
95  virtual QMargins safeAreaMargins() const;
96 
97  virtual void setVisible(bool visible);
98  virtual void setWindowFlags(Qt::WindowFlags flags);
99  virtual void setWindowState(Qt::WindowStates state);
100 
101  virtual WId winId() const;
102  virtual void setParent(const QPlatformWindow *window);
103 
104  virtual void setWindowTitle(const QString &title);
105  virtual void setWindowFilePath(const QString &title);
106  virtual void setWindowIcon(const QIcon &icon);
107  virtual bool close();
108  virtual void raise();
109  virtual void lower();
110 
111  virtual bool isExposed() const;
112  virtual bool isActive() const;
113  virtual bool isAncestorOf(const QPlatformWindow *child) const;
114  virtual bool isEmbedded() const;
115  virtual bool isForeignWindow() const { return false; }
116  virtual QPoint mapToGlobal(const QPoint &pos) const;
117  QPointF mapToGlobalF(const QPointF &pos) const;
118  virtual QPoint mapFromGlobal(const QPoint &pos) const;
119  QPointF mapFromGlobalF(const QPointF &pos) const;
120 
121  virtual void propagateSizeHints();
122 
123  virtual void setOpacity(qreal level);
124  virtual void setMask(const QRegion &region);
125  virtual void requestActivateWindow();
126 
127  virtual void handleContentOrientationChange(Qt::ScreenOrientation orientation);
128 
129  virtual qreal devicePixelRatio() const;
130 
131  virtual bool setKeyboardGrabEnabled(bool grab);
132  virtual bool setMouseGrabEnabled(bool grab);
133 
134  virtual bool setWindowModified(bool modified);
135 
136  virtual bool windowEvent(QEvent *event);
137 
138  virtual bool startSystemResize(Qt::Edges edges);
139  virtual bool startSystemMove();
140 
141  virtual void setFrameStrutEventsEnabled(bool enabled);
142  virtual bool frameStrutEventsEnabled() const;
143 
144  virtual void setAlertState(bool enabled);
145  virtual bool isAlertState() const;
146 
147  virtual void invalidateSurface();
148 
149  static QRect initialGeometry(const QWindow *w, const QRect &initialGeometry,
150  int defaultWidth, int defaultHeight,
151  const QScreen **resultingScreenReturn = nullptr);
152 
153  virtual void requestUpdate();
154  bool hasPendingUpdateRequest() const;
155  virtual void deliverUpdateRequest();
156 
157  // Window property accessors. Platform plugins should use these
158  // instead of accessing QWindow directly.
159  QSize windowMinimumSize() const;
160  QSize windowMaximumSize() const;
161  QSize windowBaseSize() const;
162  QSize windowSizeIncrement() const;
163  QRect windowGeometry() const;
164  QRect windowFrameGeometry() const;
165  QRectF windowClosestAcceptableGeometry(const QRectF &nativeRect) const;
166  static QRectF closestAcceptableGeometry(const QWindow *w, const QRectF &nativeRect);
167 
168 protected:
169  static QString formatWindowTitle(const QString &title, const QString &separator);
170  QPlatformScreen *screenForGeometry(const QRect &newGeometry) const;
171  static QSize constrainWindowSize(const QSize &size);
172 
174 };
175 
177 
178 #endif //QPLATFORMWINDOW_H
The QEvent class is the base class of all event classes. Event objects contain event parameters.
Definition: qcoreevent.h:58
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:56
The QMargins class defines the four margins of a rectangle.
Definition: qmargins.h:52
virtual QSurfaceFormat format() const =0
virtual QPlatformScreen * screen() const =0
friend class QPlatformWindow
QScopedPointer< QPlatformWindowPrivate > d_ptr
virtual bool isForeignWindow() const
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:242
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:52
The QRectF class defines a finite rectangle in the plane using floating point precision.
Definition: qrect.h:511
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:59
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:63
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition: qscreen.h:68
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:55
The QString class provides a Unicode character string.
Definition: qstring.h:388
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
The QWindow class represents a window in the underlying windowing system.
Definition: qwindow.h:99
rect
[4]
else opt state
[0]
ScreenOrientation
Definition: qnamespace.h:296
#define Q_DISABLE_COPY_MOVE(Class)
Definition: qglobal.h:519
QT_END_INCLUDE_NAMESPACE typedef double qreal
Definition: qglobal.h:341
GLenum GLuint GLint level
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLbitfield flags
struct _cl_event * event
Definition: qopenglext.h:2998
QIcon icon
[15]
QString title
[35]
QLayoutItem * child
[0]
w setWindowState(w->windowState() ^ Qt::WindowFullScreen)
[0]
aWidget window() -> setWindowTitle("New Window Title")
[2]
file setParent(multiPart)
socketLayer initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent