mirror of
https://github.com/tnodir/fort
synced 2024-11-15 04:27:09 +00:00
UI: TableView::selectedText: Use tool-tip when display text is empty
This commit is contained in:
parent
b0296048d6
commit
fab68363d1
@ -75,13 +75,22 @@ QString TableView::selectedText() const
|
||||
prevColumn = column;
|
||||
}
|
||||
|
||||
const QString s = model()->data(index).toString();
|
||||
text.append(s);
|
||||
text.append(cellText(index));
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
QString TableView::cellText(const QModelIndex &index) const
|
||||
{
|
||||
const QString displayText = model()->data(index).toString();
|
||||
if (!displayText.isEmpty())
|
||||
return displayText;
|
||||
|
||||
const QString tooltipText = model()->data(index, Qt::ToolTipRole).toString();
|
||||
return tooltipText;
|
||||
}
|
||||
|
||||
void TableView::selectCell(int row, int column)
|
||||
{
|
||||
const auto index = model()->index(row, column);
|
||||
|
@ -20,6 +20,7 @@ public:
|
||||
QModelIndexList sortedSelectedIndexes() const;
|
||||
|
||||
QString selectedText() const;
|
||||
QString cellText(const QModelIndex &index) const;
|
||||
|
||||
signals:
|
||||
void currentIndexChanged(const QModelIndex &index);
|
||||
|
Loading…
Reference in New Issue
Block a user