From 0f85243cf3cabd0314f84ba47a341ddf4f54d11a Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 21 Nov 2013 23:16:19 -0200 Subject: Fixes the correct sizes of the tables when first open. This patch fixes the correct sizes of the tables when first opened. It was defaulting to 'resizeToContents', but most of the cases when first opened we got no content, and this was bad. Now I'm defaulting to 30 when on the 'REMOVE' column and 80 on other columns. Fixes #189 Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/tableview.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'qt-ui/tableview.cpp') diff --git a/qt-ui/tableview.cpp b/qt-ui/tableview.cpp index 80100218a..c79a23491 100644 --- a/qt-ui/tableview.cpp +++ b/qt-ui/tableview.cpp @@ -54,12 +54,10 @@ void TableView::setModel(QAbstractItemModel *model){ QSettings s; s.beginGroup(objectName()); - for (int i = 0; i < ui.tableView->model()->columnCount(); i++) { - QVariant width = s.value(QString("colwidth%1").arg(i)); - if (width.isValid()) - ui.tableView->setColumnWidth(i, width.toInt()); - else - ui.tableView->resizeColumnToContents(i); + const int columnCount = ui.tableView->model()->columnCount(); + for (int i = 0; i < columnCount; i++) { + QVariant width = s.value(QString("colwidth%1").arg(i), i == CylindersModel::REMOVE ? 30 : 80 ); + ui.tableView->setColumnWidth(i, width.toInt()); } s.endGroup(); -- cgit v1.2.3-70-g09d2