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.
This commit is contained in:
Martin Kleusberg
2014-08-22 14:27:54 +02:00
parent cbc324b205
commit a3affde782

View File

@@ -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;i<model->columnCount();i++)
{
if(ui->tableResult->columnWidth(i) > 300)
ui->tableResult->setColumnWidth(i, 300);
}
}
SqlTextEdit* SqlExecutionArea::getEditor()