mirror of
https://github.com/tnodir/fort
synced 2024-11-15 05:25:56 +00:00
UI: Programs: Show Notes in Name's tooltip
This commit is contained in:
parent
060b117b07
commit
da8983f397
@ -153,7 +153,7 @@ QVariant AppListModel::data(const QModelIndex &index, int role) const
|
||||
// Label
|
||||
case Qt::DisplayRole:
|
||||
case Qt::ToolTipRole:
|
||||
return dataDisplay(index);
|
||||
return dataDisplay(index, role);
|
||||
|
||||
// Icon
|
||||
case Qt::DecorationRole:
|
||||
@ -171,7 +171,7 @@ QVariant AppListModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant AppListModel::dataDisplay(const QModelIndex &index) const
|
||||
QVariant AppListModel::dataDisplay(const QModelIndex &index, int role) const
|
||||
{
|
||||
const int row = index.row();
|
||||
const int column = index.column();
|
||||
@ -182,7 +182,7 @@ QVariant AppListModel::dataDisplay(const QModelIndex &index) const
|
||||
|
||||
switch (column) {
|
||||
case 0:
|
||||
return appRow.appName;
|
||||
return dataDisplayAppName(appRow, role);
|
||||
case 1:
|
||||
return dataDisplayState(appRow);
|
||||
case 2:
|
||||
@ -196,6 +196,13 @@ QVariant AppListModel::dataDisplay(const QModelIndex &index) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant AppListModel::dataDisplayAppName(const AppRow &appRow, int role) const
|
||||
{
|
||||
return appRow.appName
|
||||
+ (role != Qt::ToolTipRole || appRow.notes.isEmpty() ? QString()
|
||||
: "\n\n" + appRow.notes);
|
||||
}
|
||||
|
||||
QVariant AppListModel::dataDisplayState(const AppRow &appRow) const
|
||||
{
|
||||
QString text = appStateText(appRow);
|
||||
|
@ -60,7 +60,8 @@ protected:
|
||||
private:
|
||||
QVariant headerDataDisplay(int section) const;
|
||||
|
||||
QVariant dataDisplay(const QModelIndex &index) const;
|
||||
QVariant dataDisplay(const QModelIndex &index, int role) const;
|
||||
QVariant dataDisplayAppName(const AppRow &appRow, int role) const;
|
||||
QVariant dataDisplayState(const AppRow &appRow) const;
|
||||
QVariant dataDecoration(const QModelIndex &index) const;
|
||||
QVariant dataForeground(const QModelIndex &index) const;
|
||||
|
Loading…
Reference in New Issue
Block a user