2 * Stringlistmodel class
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
10 #include "stringlistmodel.h"
12 int StringListModel::rowCount(const QModelIndex &parent) const
14 return stringList.count();
17 QVariant StringListModel::data(const QModelIndex &index, int role) const
22 if (index.row() < 0 || index.row() >= stringList.size())
25 if (role == Qt::DisplayRole)
26 return stringList.at(index.row());
30 QVariant StringListModel::headerData(int section, Qt::Orientation orientation, int role) const
32 if (role != Qt::DisplayRole)
35 if (orientation == Qt::Horizontal)
36 return QString("Column %1").arg(section);
38 return QString("Row %1").arg(section);