-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindowmanager.h
52 lines (41 loc) · 1.25 KB
/
windowmanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef WINDOWMANAGER_H
#define WINDOWMANAGER_H
#include <QObject>
#include <QAbstractListModel>
#include <QList>
#include <QDateTime>
struct WindowInfo_1 {
Q_GADGET
Q_PROPERTY(QString name MEMBER name)
Q_PROPERTY(uint id MEMBER id)
Q_PROPERTY(QDateTime startTime MEMBER startTime)
public:
QString name;
uint id;
QDateTime startTime;
bool operator==(const WindowInfo_1 &other) const {
return name == other.name && id == other.id;
}
};
class WindowManager : public QAbstractListModel {
Q_OBJECT
public:
enum Roles {
NameRole = Qt::UserRole + 1,
IdRole,
StartTimeRole // 新增角色
};
Q_ENUM(Roles)
WindowManager(QObject *parent = nullptr);
// QAbstractListModel interface
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override;
QVector<WindowInfo_1> windowList() const;
void setWindowInfo_qiantai(const QString &name, uint id);
void setWindowInfo_houtai(const QString &name, uint id);
void WindowDetroyInfo(uint id);
private:
QList<WindowInfo_1> m_windowList;
};
#endif // WINDOWMANAGER_H