From a3affde7823487febc2178894cd803a6b2d51971 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Fri, 22 Aug 2014 14:27:54 +0200 Subject: [PATCH] Make sure columns in the Execute SQL area don't get too big by default When running a SQL statement the column widths of the result table view are set to fit their contents automatically. However, for very long values this makes the table hard to navigate. This is why this commit introduces a maximum column width while still trying to fit each column to its contents. See issue #79, point 2. --- src/SqlExecutionArea.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/SqlExecutionArea.cpp b/src/SqlExecutionArea.cpp index e1144d4b..0742be2f 100644 --- a/src/SqlExecutionArea.cpp +++ b/src/SqlExecutionArea.cpp @@ -57,7 +57,14 @@ QString SqlExecutionArea::getSelectedSql() const void SqlExecutionArea::finishExecution(const QString& result) { ui->editErrors->setText(result); + + // Set column widths according to their contents but make sure they don't exceed a certain size ui->tableResult->resizeColumnsToContents(); + for(int i=0;icolumnCount();i++) + { + if(ui->tableResult->columnWidth(i) > 300) + ui->tableResult->setColumnWidth(i, 300); + } } SqlTextEdit* SqlExecutionArea::getEditor()