Public Member Functions | |
| LanguageModel (const LanguageList &languages, QObject *parent=0) | |
| int | rowCount (const QModelIndex &) const |
| int | columnCount (const QModelIndex &) const |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
Definition at line 139 of file qxtlanguagecombobox.cpp.
| LanguageModel::LanguageModel | ( | const LanguageList & | languages, |
| QObject * | parent = 0 |
||
| ) | [inline] |
Definition at line 142 of file qxtlanguagecombobox.cpp.
: QAbstractTableModel(parent), _mLanguages(languages)
{
}
| int LanguageModel::columnCount | ( | const QModelIndex & | ) | const [inline] |
Definition at line 152 of file qxtlanguagecombobox.cpp.
{
return 2;
}
| QVariant LanguageModel::data | ( | const QModelIndex & | index, |
| int | role = Qt::DisplayRole |
||
| ) | const [inline] |
Definition at line 157 of file qxtlanguagecombobox.cpp.
{
if (!index.isValid())
return QVariant();
if (_mLanguages.empty())
return QVariant();
int idx = qMin(index.row(), _mLanguages.size());
const Language& l = _mLanguages[idx];
if (role == Qt::DecorationRole)
{
return QIcon(":/flags/" + l.countryName() + ".png");
}
if (role == Qt::DisplayRole)
{
switch (index.column())
{
case 0:
return l.name();
case 1:
return l.language();
default:
return QVariant();
}
}
return QVariant();
}
| int LanguageModel::rowCount | ( | const QModelIndex & | ) | const [inline] |
Definition at line 147 of file qxtlanguagecombobox.cpp.
{
return _mLanguages.size();
}
1.7.2