blob: 306b9d891825d1977797b312027ae08cb81a9622 (
plain)
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
53
54
55
56
57
58
59
60
61
|
#ifndef WATCHTABLEMODEL_H
#define WATCHTABLEMODEL_H
#include <QWidget>
#include <QtCore/qpointer.h>
#include <QtCore/qlist.h>
#include <QAbstractTableModel>
QT_BEGIN_NAMESPACE
class QmlDebugWatch;
class WatchTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
WatchTableModel(QObject *parent = 0);
void addWatch(QmlDebugWatch *watch, const QString &title);
void updateWatch(QmlDebugWatch *watch, const QVariant &value);
QmlDebugWatch *findWatch(int column) const;
QmlDebugWatch *findWatch(int objectDebugId, const QString &property) const;
QList<QmlDebugWatch *> watches() const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
private slots:
void watchStateChanged();
private:
int columnForWatch(QmlDebugWatch *watch) const;
void addValue(int column, const QVariant &value);
void removeWatch(QmlDebugWatch *watch);
struct WatchedEntity
{
QString title;
bool hasFirstValue;
QString property;
QPointer<QmlDebugWatch> watch;
};
struct Value {
int column;
QVariant variant;
bool first;
};
QList<WatchedEntity> m_columns;
QList<Value> m_values;
};
QT_END_NAMESPACE
#endif // WATCHTABLEMODEL_H
|