| 1 |
#ifndef WINDOWDATA_H |
| 2 |
#define WINDOWDATA_H |
| 3 |
|
| 4 |
#include <QObject> |
| 5 |
#include <QJsonObject> |
| 6 |
#include <QRect> |
| 7 |
|
| 8 |
class QScreen; |
| 9 |
|
| 10 |
class WindowData : public QObject |
| 11 |
{ |
| 12 |
Q_OBJECT |
| 13 |
|
| 14 |
Q_PROPERTY(QRect windowRect READ windowRect WRITE setWindowRect NOTIFY windowRectChanged) |
| 15 |
public: |
| 16 |
explicit WindowData(QObject *parent = nullptr); |
| 17 |
|
| 18 |
QJsonObject saveState() const; |
| 19 |
bool restoreState(QJsonObject state); |
| 20 |
|
| 21 |
QRect windowRect() const; |
| 22 |
QScreen* screen() const; |
| 23 |
|
| 24 |
Qt::WindowState windowState() const |
| 25 |
{ return m_state; } |
| 26 |
|
| 27 |
void setWindowState(Qt::WindowState ws); |
| 28 |
|
| 29 |
QString title() const |
| 30 |
{ return m_title; } |
| 31 |
signals: |
| 32 |
|
| 33 |
void windowRectChanged(QRect windowRect); |
| 34 |
|
| 35 |
public slots: |
| 36 |
|
| 37 |
void setWindowRect(QRect windowRect); |
| 38 |
|
| 39 |
private: |
| 40 |
QRect m_windowRect; |
| 41 |
Qt::WindowState m_state = Qt::WindowNoState; |
| 42 |
QString m_screenName; |
| 43 |
QString m_title; |
| 44 |
}; |
| 45 |
|
| 46 |
#endif |