Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qqnxscreen.h
Go to the documentation of this file.
1// Copyright (C) 2011 - 2012 Research In Motion
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QBBSCREEN_H
5#define QBBSCREEN_H
6
7#include <qpa/qplatformscreen.h>
8
9#include "qqnxwindow.h"
10
11#include <QtCore/QObject>
12#include <QtCore/QScopedPointer>
13
14#include <screen/screen.h>
15
16#if !defined(_SCREEN_VERSION)
17#define _SCREEN_MAKE_VERSION(major, minor, patch) (((major) * 10000) + ((minor) * 100) + (patch))
18#define _SCREEN_VERSION _SCREEN_MAKE_VERSION(0, 0, 0)
19#endif
20
21// For pre-1.0.0 screen, map some screen property names to the old
22// names.
23#if _SCREEN_VERSION < _SCREEN_MAKE_VERSION(1, 0, 0)
24const int SCREEN_PROPERTY_FLAGS = SCREEN_PROPERTY_KEY_FLAGS;
25const int SCREEN_PROPERTY_FOCUS = SCREEN_PROPERTY_KEYBOARD_FOCUS;
26const int SCREEN_PROPERTY_MODIFIERS = SCREEN_PROPERTY_KEY_MODIFIERS;
27const int SCREEN_PROPERTY_SCAN = SCREEN_PROPERTY_KEY_SCAN;
28const int SCREEN_PROPERTY_SYM = SCREEN_PROPERTY_KEY_SYM;
29#endif
30
32
33class QQnxWindow;
34
35class QQnxScreen : public QObject, public QPlatformScreen
36{
38public:
39 QQnxScreen(screen_context_t context, screen_display_t display, bool primaryScreen);
41
42 QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
43
44 QRect geometry() const override { return m_currentGeometry; }
45 QRect availableGeometry() const override;
46 int depth() const override;
47 QImage::Format format() const override { return (depth() == 32) ? QImage::Format_RGB32 : QImage::Format_RGB16; }
48 QSizeF physicalSize() const override { return m_currentPhysicalSize; }
49
50 qreal refreshRate() const override;
51
53 Qt::ScreenOrientation orientation() const override;
54
55 QWindow *topLevelAt(const QPoint &point) const override;
56
57 bool isPrimaryScreen() const { return m_primaryScreen; }
58
59 int rotation() const { return m_currentRotation; }
60
61 QString name() const override { return m_name; }
62
63 int nativeFormat() const { return (depth() == 32) ? SCREEN_FORMAT_RGBA8888 : SCREEN_FORMAT_RGB565; }
64 screen_display_t nativeDisplay() const { return m_display; }
65 screen_context_t nativeContext() const { return m_screenContext; }
66 const char *windowGroupName() const { return m_rootWindow ? m_rootWindow->groupName().constData() : 0; }
67
68 QQnxWindow *findWindow(screen_window_t windowHandle) const;
69
70 /* Window hierarchy management */
75 void updateHierarchy();
76
77 void adjustOrientation();
78
79 QQnxWindow *rootWindow() const;
81
82 QPlatformCursor *cursor() const override;
83
87
88public Q_SLOTS:
89 void setRotation(int rotation);
90 void newWindowCreated(void *window);
91 void windowClosed(void *window);
93 void activateWindowGroup(const QByteArray &id);
94 void deactivateWindowGroup(const QByteArray &id);
95
96private Q_SLOTS:
97 void keyboardHeightChanged(int height);
98
99private:
100 void resizeNativeWidgetWindow(QQnxWindow *w, const QRect &previousScreenGeometry) const;
101 void resizeTopLevelWindow(QQnxWindow *w, const QRect &previousScreenGeometry) const;
102 void resizeWindows(const QRect &previousScreenGeometry);
103 void addOverlayWindow(screen_window_t window);
104 void addUnderlayWindow(screen_window_t window);
105 void removeOverlayOrUnderlayWindow(screen_window_t window);
106
107 screen_context_t m_screenContext;
108 screen_display_t m_display;
109 QQnxWindow *m_rootWindow;
110 const bool m_primaryScreen;
111
112 int m_initialRotation;
113 int m_currentRotation;
114 int m_keyboardHeight;
115 QString m_name;
116 QSize m_initialPhysicalSize;
117 QSize m_currentPhysicalSize;
118 Qt::ScreenOrientation m_nativeOrientation;
119 QRect m_initialGeometry;
120 QRect m_currentGeometry;
121
122 QList<QQnxWindow *> m_childWindows;
123 QQnxWindow *m_coverWindow;
124 QList<screen_window_t> m_overlays;
125 QList<screen_window_t> m_underlays;
126
127 QPlatformCursor *m_cursor;
128};
129
131
132#endif // QBBSCREEN_H
\inmodule QtCore
Definition qbytearray.h:57
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
Definition qbytearray.h:122
Format
The following image formats are available in Qt.
Definition qimage.h:41
@ Format_RGB32
Definition qimage.h:46
@ Format_RGB16
Definition qimage.h:49
Definition qlist.h:74
\inmodule QtCore
Definition qobject.h:90
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
The QPlatformCursor class provides information about pointer device events (movement,...
The QPlatformScreen class provides an abstraction for visual displays.
\inmodule QtCore\reentrant
Definition qpoint.h:23
void windowClosed(void *window)
const char * windowGroupName() const
Definition qqnxscreen.h:66
Qt::ScreenOrientation nativeOrientation() const override
Reimplement this function in subclass to return the native orientation of the screen,...
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
Definition qqnxscreen.h:44
QPlatformCursor * cursor() const override
Reimplement this function in subclass to return the cursor of the screen.
Qt::ScreenOrientation orientation() const override
Reimplement this function in subclass to return the current orientation of the screen,...
QWindow * topLevelAt(const QPoint &point) const override
Return the given top level window for a given position.
void lowerWindow(QQnxWindow *window)
bool isPrimaryScreen() const
Definition qqnxscreen.h:57
void raiseWindow(QQnxWindow *window)
void activateWindowGroup(const QByteArray &id)
void foreignWindowClosed(void *window)
void removeWindow(QQnxWindow *child)
void addWindow(QQnxWindow *child)
QRect availableGeometry() const override
Reimplement in subclass to return the pixel geometry of the available space This normally is the desk...
screen_context_t nativeContext() const
Definition qqnxscreen.h:65
void deactivateWindowGroup(const QByteArray &id)
QImage::Format format() const override
Reimplement in subclass to return the image format which corresponds to the screen format.
Definition qqnxscreen.h:47
int nativeFormat() const
Definition qqnxscreen.h:63
int rotation() const
Definition qqnxscreen.h:59
QPixmap grabWindow(WId window, int x, int y, int width, int height) const override
This function is called when Qt needs to be able to grab the content of a window.
QQnxWindow * findWindow(screen_window_t windowHandle) const
void foreignWindowCreated(void *window)
QSizeF physicalSize() const override
Reimplement this function in subclass to return the physical size of the screen, in millimeters.
Definition qqnxscreen.h:48
QString name() const override
Definition qqnxscreen.h:61
void setRootWindow(QQnxWindow *)
int depth() const override
Reimplement in subclass to return current depth of the screen.
void adjustOrientation()
screen_display_t nativeDisplay() const
Definition qqnxscreen.h:64
void setRotation(int rotation)
QQnxWindow * rootWindow() const
void newWindowCreated(void *window)
qreal refreshRate() const override
Reimplement this function in subclass to return the vertical refresh rate of the screen,...
void updateHierarchy()
void windowGroupStateChanged(const QByteArray &id, Qt::WindowState state)
The QQnxWindow is the base class of the various classes used as instances of QPlatformWindow in the Q...
Definition qqnxwindow.h:28
QByteArray groupName() const
Definition qqnxwindow.h:67
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qsize.h:207
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtGui
Definition qwindow.h:63
else opt state
[0]
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
WindowState
Definition qnamespace.h:250
ScreenOrientation
Definition qnamespace.h:270
static void * context
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLint GLsizei width
GLint y
const int SCREEN_PROPERTY_SYM
Definition qqnxscreen.h:28
const int SCREEN_PROPERTY_SCAN
Definition qqnxscreen.h:27
const int SCREEN_PROPERTY_FOCUS
Definition qqnxscreen.h:25
const int SCREEN_PROPERTY_MODIFIERS
Definition qqnxscreen.h:26
const int SCREEN_PROPERTY_FLAGS
Definition qqnxscreen.h:24
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
double qreal
Definition qtypes.h:92
QLayoutItem * child
[0]
aWidget window() -> setWindowTitle("New Window Title")
[2]