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// Qt-Security score:significant reason:default
4
5//
6// W A R N I N G
7// -------------
8//
9// This file is not part of the Qt API. It exists for the convenience
10// of Qt Designer. This header file may change from version to version
11// without notice, or even be removed.
12//
13// We mean it.
14//
15
16#ifndef SKIN_H
17#define SKIN_H
18
19#include <QtWidgets/qwidget.h>
20
21#include <QtGui/qpixmap.h>
22#include <QtGui/qpolygon.h>
23#include <QtGui/qregion.h>
24
25#include <QtCore/qlist.h>
26
28
29namespace qvfb_internal {
30 class CursorWindow;
31}
32
33class QTextStream;
34
35// ------- Button Area
37 QString name;
38 int keyCode{0};
40 QString text;
41 bool activeWhenClosed{false};
42 bool toggleArea{false};
43 bool toggleActiveArea{false};
44};
45
46// -------- Parameters
49 bool read(const QString &skinDirectory, ReadMode rm, QString *errorMessage);
50 bool read(QTextStream &ts, ReadMode rm, QString *errorMessage);
51
52 QSize screenSize() const { return screenRect.size(); }
53 QSize secondaryScreenSize() const;
54 bool hasSecondaryScreen() const;
55
60
65
73
75 QString prefix;
77};
78
79// --------- Skin Widget
80class DeviceSkin : public QWidget
81{
83public:
86
87 QWidget *view() const { return m_view; }
88 void setView( QWidget *v );
89
90 QWidget *secondaryView() const { return m_secondaryView; }
91 void setSecondaryView( QWidget *v );
92
93 void setZoom( double );
94 void setTransform(const QTransform &);
95
96 bool hasCursor() const;
97
98 QString prefix() const {return m_parameters.prefix;}
99
100signals:
101 void popupMenu();
102 void skinKeyPressEvent(int code, const QString& text, bool autorep);
103 void skinKeyReleaseEvent(int code, const QString& text, bool autorep);
104
105protected slots:
106 void skinKeyRepeat();
107 void moveParent();
108
109protected:
110 void paintEvent(QPaintEvent *) override;
111 void mousePressEvent(QMouseEvent *e) override;
112 void mouseMoveEvent(QMouseEvent *e) override;
113 void mouseReleaseEvent(QMouseEvent *) override;
114
115private:
116 void calcRegions();
117 void flip(bool open);
118 void updateSecondaryScreen();
119 void loadImages();
120 void startPress(int);
121 void endPress();
122
123 const DeviceSkinParameters m_parameters;
124 QList<QRegion> buttonRegions;
125 QPixmap skinImageUp;
126 QPixmap skinImageDown;
127 QPixmap skinImageClosed;
128 QPixmap skinCursor;
129 QWidget *parent;
130 QWidget *m_view = nullptr;
131 QWidget *m_secondaryView = nullptr;
132 QPoint parentpos;
133 QPoint clickPos;
134 bool buttonPressed = false;
135 int buttonIndex = 0;
136 QTransform transform;
137 qvfb_internal::CursorWindow *cursorw = nullptr;
138
139 bool joydown = false;
140 QTimer *t_skinkey;
141 QTimer *t_parentmove;
142 int onjoyrelease = 0;
143
144 bool flipped_open = true;
145};
146
147QT_END_NAMESPACE
148
149#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...
~DeviceSkin() override
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:432
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