summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-16 13:28:59 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-16 13:28:59 -0300
commit20849f014eafa7ed697fb65af139ce3ee0561605 (patch)
treef2ad19b21559fdf13e2db59b871951024ad2a331 /qt-ui/maintab.cpp
parentf9b4c6b889e2444533af1baabdee3687020c1e7b (diff)
downloadsubsurface-20849f014eafa7ed697fb65af139ce3ee0561605.tar.gz
Make the columns have a sane default width for 'type'
Make the columns on Cylinders edit and Wheight Edit to have sane values for 'type', this is needed because the old behavior was to set it fixed size, and the default fixed size was silly. this calculates a good predefined value taking the font size in consideration. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 6f63b3574..bee94fb4b 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -80,12 +80,16 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
connect(ui->weights, SIGNAL(clicked(QModelIndex)), ui->weights->model(), SLOT(remove(QModelIndex)));
QFontMetrics metrics(defaultModelFont());
+ QFontMetrics metrics2(font());
ui->cylinders->setColumnWidth(CylindersModel::REMOVE, 24);
+ ui->cylinders->setColumnWidth(CylindersModel::TYPE, metrics2.width(TankInfoModel::instance()->biggerString()) + 20);
ui->cylinders->horizontalHeader()->setResizeMode(CylindersModel::REMOVE, QHeaderView::Fixed);
ui->cylinders->verticalHeader()->setDefaultSectionSize( metrics.height() +8 );
ui->cylinders->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate());
+
ui->weights->setColumnWidth(WeightModel::REMOVE, 24);
+ ui->weights->setColumnWidth(WeightModel::TYPE, metrics2.width(WSInfoModel::instance()->biggerString()) + 20);
ui->weights->horizontalHeader()->setResizeMode (WeightModel::REMOVE , QHeaderView::Fixed);
ui->weights->verticalHeader()->setDefaultSectionSize( metrics.height() +8 );
ui->weights->setItemDelegateForColumn(WeightModel::TYPE, new WSInfoDelegate());