diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2014-10-15 15:30:52 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-10-18 15:16:15 -0700 |
commit | 32ab2b34d39752693697f0f2a33032ceb3f5f3b4 (patch) | |
tree | c661c4b6609647f364d09eae609ff5b672fc9f20 /qt-ui/tableview.cpp | |
parent | 72b256de629c7e4ef5c52d7a9ce62ebd68a77991 (diff) | |
download | subsurface-32ab2b34d39752693697f0f2a33032ceb3f5f3b4.tar.gz |
Unify icon metrics
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/tableview.cpp')
-rw-r--r-- | qt-ui/tableview.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/qt-ui/tableview.cpp b/qt-ui/tableview.cpp index 689a2c1cf..a05b1744c 100644 --- a/qt-ui/tableview.cpp +++ b/qt-ui/tableview.cpp @@ -16,10 +16,8 @@ TableView::TableView(QWidget *parent) : QWidget(parent) QFontMetrics fm(defaultModelFont()); int text_ht = fm.height(); int text_em = fm.width('m'); - // set icon and button size from the default icon size - metrics.icon_size = defaultIconSize(text_ht); - metrics.btn_size = metrics.icon_size + metrics.icon_size/2; - metrics.btn_gap = metrics.icon_size/8; + + metrics.icon = &defaultIconMetrics(); metrics.col_width = 7*text_em; metrics.rm_col_width = 3*text_em; @@ -35,7 +33,7 @@ TableView::TableView(QWidget *parent) : QWidget(parent) plusBtn = new QPushButton(plusIcon, QString(), ui.groupBox); plusBtn->setFlat(true); plusBtn->setToolTip(tr("Add cylinder")); - plusBtn->setIconSize(QSize(metrics.icon_size, metrics.icon_size)); + plusBtn->setIconSize(QSize(metrics.icon->sz_small, metrics.icon->sz_small)); connect(plusBtn, SIGNAL(clicked(bool)), this, SIGNAL(addButtonClicked())); } @@ -91,9 +89,10 @@ void TableView::setModel(QAbstractItemModel *model) void TableView::fixPlusPosition() { - int x = ui.groupBox->contentsRect().width() - 2*metrics.icon_size + metrics.btn_gap; - int y = metrics.btn_gap; - plusBtn->setGeometry(x, y, metrics.btn_size, metrics.btn_size); + int x = ui.groupBox->contentsRect().width() - 2*metrics.icon->sz_small + metrics.icon->spacing; + int y = metrics.icon->spacing; + int sz = metrics.icon->sz_med; + plusBtn->setGeometry(x, y, sz, sz); } // We need to manually position the 'plus' on cylinder and weight. |