Allows to display callsign / user / statusmessage as icon in views. refs #122

* Icons
* update of resource file
* update in CValueObject classes callsign / user / statusmessage
* update in list models, data method for returning Pixmap
This commit is contained in:
Klaus Basan
2014-02-05 21:47:36 +00:00
committed by Mathew Sutcliffe
parent 431b347cfd
commit 7a63768c83
19 changed files with 87 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ namespace BlackGui
CUserListModel::CUserListModel(QObject *parent) :
CListModelBase<BlackMisc::Network::CUser, BlackMisc::Network::CUserList>("ViewUserList", parent)
{
this->m_columns.addColumn(CUser::IndexCallsignIcon, "");
this->m_columns.addColumn(CUser::IndexRealName, "realname");
this->m_columns.addColumn(CUser::IndexCallsign, "callsign");
this->m_columns.addColumn(CUser::IndexId, "userid");
@@ -24,4 +25,22 @@ namespace BlackGui
(void)QT_TRANSLATE_NOOP("ViewUserList", "userid");
(void)QT_TRANSLATE_NOOP("ViewUserList", "email");
}
/*
* Display icons
*/
QVariant CUserListModel::data(const QModelIndex &modelIndex, int role) const
{
// shortcut, fast check
if (role != Qt::DecorationRole) return CListModelBase::data(modelIndex, role);
if (this->columnToPropertyIndex(modelIndex.column()) == CUser::IndexCallsignIcon)
{
if (role == Qt::DecorationRole)
{
CUser u = this->at(modelIndex);
return u.toIcon();
}
}
return CListModelBase::data(modelIndex, role);
}
}