mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
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:
committed by
Mathew Sutcliffe
parent
431b347cfd
commit
7a63768c83
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ namespace BlackGui
|
||||
* \brief Destructor
|
||||
*/
|
||||
virtual ~CUserListModel() {}
|
||||
|
||||
//! \copydoc CListModelBase::data
|
||||
QVariant data(const QModelIndex &modelIndex, int role = Qt::DisplayRole) const;
|
||||
};
|
||||
}
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user