diff --git a/src/ui/form/controls/tableview.cpp b/src/ui/form/controls/tableview.cpp index 2c53ba19..40587c7c 100644 --- a/src/ui/form/controls/tableview.cpp +++ b/src/ui/form/controls/tableview.cpp @@ -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); diff --git a/src/ui/form/controls/tableview.h b/src/ui/form/controls/tableview.h index 486ef11b..eaef1eb1 100644 --- a/src/ui/form/controls/tableview.h +++ b/src/ui/form/controls/tableview.h @@ -20,6 +20,7 @@ public: QModelIndexList sortedSelectedIndexes() const; QString selectedText() const; + QString cellText(const QModelIndex &index) const; signals: void currentIndexChanged(const QModelIndex &index);