mirror of
https://github.com/tnodir/fort
synced 2024-11-15 06:15:15 +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;
|
prevColumn = column;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString s = model()->data(index).toString();
|
text.append(cellText(index));
|
||||||
text.append(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return text;
|
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)
|
void TableView::selectCell(int row, int column)
|
||||||
{
|
{
|
||||||
const auto index = model()->index(row, column);
|
const auto index = model()->index(row, column);
|
||||||
|
@ -20,6 +20,7 @@ public:
|
|||||||
QModelIndexList sortedSelectedIndexes() const;
|
QModelIndexList sortedSelectedIndexes() const;
|
||||||
|
|
||||||
QString selectedText() const;
|
QString selectedText() const;
|
||||||
|
QString cellText(const QModelIndex &index) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentIndexChanged(const QModelIndex &index);
|
void currentIndexChanged(const QModelIndex &index);
|
||||||
|
Loading…
Reference in New Issue
Block a user