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
deviceskin_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists for the convenience
9// of Qt Designer. This header file may change from version to version
10// without notice, or even be removed.
11//
12// We mean it.
13//
14
15#ifndef SKIN_H
16#define SKIN_H
17
18#include <QtWidgets/QWidget>
19
20#include <QtGui/QPixmap>
21#include <QtGui/QPolygon>
22#include <QtGui/QRegion>
23
24#include <QtCore/QList>
25
27
28namespace qvfb_internal {
29 class CursorWindow;
30}
31
32class QTextStream;
33
34// ------- Button Area
36 QString name;
37 int keyCode{0};
39 QString text;
40 bool activeWhenClosed{false};
41 bool toggleArea{false};
42 bool toggleActiveArea{false};
43};
44
45// -------- Parameters
48 bool read(const QString &skinDirectory, ReadMode rm, QString *errorMessage);
49 bool read(QTextStream &ts, ReadMode rm, QString *errorMessage);
50
51 QSize screenSize() const { return screenRect.size(); }
52 QSize secondaryScreenSize() const;
53 bool hasSecondaryScreen() const;
54
59
64
72
74 QString prefix;
76};
77
78// --------- Skin Widget
79class DeviceSkin : public QWidget
80{
82public:
84 ~DeviceSkin( );
85
86 QWidget *view() const { return m_view; }
87 void setView( QWidget *v );
88
89 QWidget *secondaryView() const { return m_secondaryView; }
90 void setSecondaryView( QWidget *v );
91
92 void setZoom( double );
93 void setTransform(const QTransform &);
94
95 bool hasCursor() const;
96
97 QString prefix() const {return m_parameters.prefix;}
98
100 void popupMenu();
101 void skinKeyPressEvent(int code, const QString& text, bool autorep);
102 void skinKeyReleaseEvent(int code, const QString& text, bool autorep);
103
104protected slots:
105 void skinKeyRepeat();
106 void moveParent();
107
108protected:
109 void paintEvent(QPaintEvent *) override;
110 void mousePressEvent(QMouseEvent *e) override;
111 void mouseMoveEvent(QMouseEvent *e) override;
112 void mouseReleaseEvent(QMouseEvent *) override;
113
114private:
115 void calcRegions();
116 void flip(bool open);
117 void updateSecondaryScreen();
118 void loadImages();
119 void startPress(int);
120 void endPress();
121
122 const DeviceSkinParameters m_parameters;
123 QList<QRegion> buttonRegions;
124 QPixmap skinImageUp;
125 QPixmap skinImageDown;
126 QPixmap skinImageClosed;
127 QPixmap skinCursor;
128 QWidget *parent;
129 QWidget *m_view = nullptr;
130 QWidget *m_secondaryView = nullptr;
131 QPoint parentpos;
132 QPoint clickPos;
133 bool buttonPressed = false;
134 int buttonIndex = 0;
135 QTransform transform;
136 qvfb_internal::CursorWindow *cursorw = nullptr;
137
138 bool joydown = false;
139 QTimer *t_skinkey;
140 QTimer *t_parentmove;
141 int onjoyrelease = 0;
142
143 bool flipped_open = true;
144};
145
146QT_END_NAMESPACE
147
148#endif
void mouseReleaseEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
void mousePressEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void mouseMoveEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
QWidget * secondaryView() const
void setSecondaryView(QWidget *v)
QWidget * view() const
void setZoom(double)
void skinKeyPressEvent(int code, const QString &text, bool autorep)
void setTransform(const QTransform &)
bool hasCursor() const
void skinKeyReleaseEvent(int code, const QString &text, bool autorep)
QString prefix() const
void moveParent()
void setView(QWidget *v)
friend class QWidget
Definition qpainter.h:421
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
static constexpr auto skinResourcePathC
static constexpr auto skinExtensionC
static const Skins & defaultSkins()
QList< DeviceSkinButtonArea > buttonAreas
QSize screenSize() const
bool read(QTextStream &ts, ReadMode rm, QString *errorMessage)
bool read(const QString &skinDirectory, ReadMode rm, QString *errorMessage)
QString skinImageDownFileName
bool hasSecondaryScreen() const
QSize secondaryScreenSize() const
QString skinImageClosedFileName
QList< int > toggleAreaList