summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-11-21 23:16:19 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-22 07:32:53 -0800
commit0f85243cf3cabd0314f84ba47a341ddf4f54d11a (patch)
tree2827cea851806ed23a1695b835e3b3246c26aa6e
parent891892cde443a6e6fe53ec808c66fc3a698c68c7 (diff)
downloadsubsurface-0f85243cf3cabd0314f84ba47a341ddf4f54d11a.tar.gz
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 <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/tableview.cpp10
1 files changed, 4 insertions, 6 deletions
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();