-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
scriptmodel.cpp
35 lines (32 loc) · 922 Bytes
/
scriptmodel.cpp
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
#include "scriptmodel.h"
ScriptModel::ScriptModel()
: QStandardItemModel()
{
setColumnCount(3);
}
void ScriptModel::append(const QString& name, const QString& file, const QString& icon)
{
int r = rowCount();
insertRow(r);
setData(index(r, 0), name);
setData(index(r, 1), file);
setData(index(r, 2), icon);
}
QVariant ScriptModel::headerData ( int section, Qt::Orientation orientation, int role) const {
switch(role) {
case Qt::DisplayRole: {
switch(orientation) {
case Qt::Horizontal: {
switch(section) {
case 0: return QObject::tr("Name");
case 1: return QObject::tr("File");
case 2: return QObject::tr("Icon");
default: return QVariant();
}
}
default: return QString::number(section);
}
}
default: return QVariant();
}
}