mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
Do not show more than 512 characters in DB Structure tooltips
Truncate the SQL create sentence when it is longer than 512 characters and pad with "...". See issue #1659
This commit is contained in:
@@ -51,8 +51,16 @@ QVariant DbStructureModel::data(const QModelIndex& index, int role) const
|
||||
else
|
||||
return Settings::getValue("db", "hideschemalinebreaks").toBool() ? item->text(index.column()).replace("\n", " ").simplified() : item->text(index.column());
|
||||
case Qt::EditRole:
|
||||
case Qt::ToolTipRole: // Don't modify the text when it's supposed to be shown in a tooltip
|
||||
return item->text(index.column());
|
||||
case Qt::ToolTipRole: {
|
||||
// Show the original text but limited, when it's supposed to be shown in a tooltip
|
||||
QString text = item->text(index.column());
|
||||
if (text.length() > 512) {
|
||||
text.truncate(509);
|
||||
text.append("...");
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case Qt::DecorationRole:
|
||||
return item->icon(index.column());
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user