forked from proton/zNotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscriptmodel.cpp
More file actions
41 lines (38 loc) · 814 Bytes
/
scriptmodel.cpp
File metadata and controls
41 lines (38 loc) · 814 Bytes
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
#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();
}
}
case Qt::Vertical: return QString::number(section);
}
}
default: return QVariant();
}
}