2
#include "themesmodel.h"
4
ThemesModel::ThemesModel(QStringList themes, QObject *parent) :
5
QAbstractListModel(parent)
7
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
8
m_data.reserve(themes.size());
11
foreach(QString theme, themes)
13
m_data.append(QHash<int, QVariant>());
14
m_data.last().insert(Qt::DisplayRole, theme);
18
int ThemesModel::rowCount(const QModelIndex &parent) const
26
QVariant ThemesModel::data(const QModelIndex &index, int role) const
28
if(index.column() > 0 || index.row() >= m_data.size())
31
return m_data.at(index.row()).value(role);
34
bool ThemesModel::setData(const QModelIndex &index, const QVariant &value, int role)
36
if(index.column() > 0 || index.row() >= m_data.size())
40
m_data[index.row()].insert(role, value);