mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Usability improvements for Extended Table Widget and SQL
results pane Copy for multi-line text data surrounds the text with the <pre> tag in the HTML version for avoiding line white-space adjustments in the pasted text. See #1058 Do not use binary data in the "Use as Filter" option. Indicate the existence of an error in the background of the SQL results frame. The error-indicators is reused for disabling this functionality. When nothing is shown, a placeholder text hints the objective of the results pane. The preference label for the font size of this pane is modified for consistency (SQL Log is another widget).
This commit is contained in:
@@ -260,10 +260,14 @@ void ExtendedTableWidget::copy(const bool withHeaders)
|
||||
QVariant data = index.data(Qt::EditRole);
|
||||
|
||||
// Table cell data
|
||||
htmlResult.append(data.toString().toHtmlEscaped());
|
||||
// non-NULL data is enquoted, whilst NULL isn't
|
||||
QString text = data.toString();
|
||||
if (text.contains('\n'))
|
||||
htmlResult.append("<pre>" + data.toString().toHtmlEscaped() + "</pre>");
|
||||
else
|
||||
htmlResult.append(data.toString().toHtmlEscaped());
|
||||
|
||||
// non-NULL data is enquoted in plain text format, whilst NULL isn't
|
||||
if (!data.isNull()) {
|
||||
QString text = data.toString();
|
||||
text.replace("\"", "\"\"");
|
||||
result.append(QString("\"%1\"").arg(text));
|
||||
}
|
||||
@@ -409,9 +413,10 @@ void ExtendedTableWidget::paste()
|
||||
void ExtendedTableWidget::useAsFilter()
|
||||
{
|
||||
QModelIndex index = selectionModel()->currentIndex();
|
||||
SqliteTableModel* m = qobject_cast<SqliteTableModel*>(model());
|
||||
|
||||
// Abort if there's nothing to filter
|
||||
if (!index.isValid() || !selectionModel()->hasSelection())
|
||||
if (!index.isValid() || !selectionModel()->hasSelection() || m->isBinary(index))
|
||||
return;
|
||||
|
||||
QVariant data = model()->data(index, Qt::EditRole);
|
||||
|
||||
Reference in New Issue
Block a user