forked from GLDsuh-a/qt-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
layertablemodel.h
54 lines (44 loc) · 1.3 KB
/
layertablemodel.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
53
54
#ifndef LAYERLISTMODEL_H
#define LAYERLISTMODEL_H
#include <QList>
#include <QIcon>
#include <QDebug>
#include <QImage>
#include <QPixmap>
#include <QStringList>
#include <QAbstractTableModel>
#include <QItemSelectionModel>
class LayerTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
LayerTableModel(QObject *parent = 0);
~LayerTableModel();
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
void deleteItem(int index);
void addItem(QString &layerName, QImage &thumbnail, bool isShow = true);
void refreshModel();
QModelIndex& selecttedIndex(int row);
void setSelecttedRow(int row);
int getSelecttedRow() const;
public slots:
void changeLayerVisibility(const QModelIndex&);
private:
struct LayerItem
{
QString layerName;
QImage thumbnail;
float transparence;
bool isShow;
};
QList<LayerItem> layerList;
int selectedRow;
};
#endif // LAYERLISTMODEL_H