Added new tab "Measure" in main window
[speedfreak] / Client / stringlistmodel.cpp
1 #include "stringlistmodel.h"
2
3 int StringListModel::rowCount(const QModelIndex &parent) const
4 {
5     return stringList.count();
6 }
7
8 QVariant StringListModel::data(const QModelIndex &index, int role) const
9 {
10     if (!index.isValid())
11         return QVariant();
12
13     if (index.row() < 0 || index.row() >= stringList.size())
14         return QVariant();
15
16     if (role == Qt::DisplayRole)
17         return stringList.at(index.row());
18     else
19         return QVariant();
20 }
21 QVariant StringListModel::headerData(int section, Qt::Orientation orientation, int role) const
22 {
23     if (role != Qt::DisplayRole)
24         return QVariant();
25
26     if (orientation == Qt::Horizontal)
27         return QString("Column %1").arg(section);
28     else
29         return QString("Row %1").arg(section);
30 }