Added implementation to handleCheckPoint slot function in carmainwindow.cpp. Now...
[speedfreak] / Client / stringlistmodel.cpp
1 /*
2  * Stringlistmodel class
3  *
4  * @author      Toni Jussila <toni.jussila@fudeco.com>
5  * @copyright   (c) 2010 Speed Freak team
6  * @license     http://opensource.org/licenses/gpl-license.php GNU Public License
7  * @exaple      http://qt.nokia.com/doc/4.0/qt4-interview.html#example-code
8  */
9
10 #include "stringlistmodel.h"
11
12 int StringListModel::rowCount(const QModelIndex &parent) const
13 {
14     return stringList.count();
15 }
16
17 QVariant StringListModel::data(const QModelIndex &index, int role) const
18 {
19     if (!index.isValid())
20         return QVariant();
21
22     if (index.row() < 0 || index.row() >= stringList.size())
23         return QVariant();
24
25     if (role == Qt::DisplayRole)
26         return stringList.at(index.row());
27     else
28         return QVariant();
29 }
30 QVariant StringListModel::headerData(int section, Qt::Orientation orientation, int role) const
31 {
32     if (role != Qt::DisplayRole)
33         return QVariant();
34
35     if (orientation == Qt::Horizontal)
36         return QString("Column %1").arg(section);
37     else
38         return QString("Row %1").arg(section);
39 }