mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
TableView: fix button sizing
Ensure that there is no (clipped) overflowfrom the header. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
58ac3b8f86
commit
4de44e6c9f
1 changed files with 13 additions and 2 deletions
|
@ -53,8 +53,19 @@ TableView::TableView(QWidget *parent) : QGroupBox(parent)
|
|||
plusBtn = new QPushButton(plusIcon, QString(), this);
|
||||
plusBtn->setFlat(true);
|
||||
plusBtn->setToolTip(tr("Add cylinder"));
|
||||
plusBtn->setIconSize(QSize(metrics.icon->sz_small, metrics.icon->sz_small));
|
||||
plusBtn->resize(metrics.icon->sz_med, metrics.icon->sz_med);
|
||||
|
||||
/* now determine the icon and button size. Since the button will be
|
||||
* placed in the label, make sure that we do not overflow, as it might
|
||||
* get clipped
|
||||
*/
|
||||
int iconSize = metrics.icon->sz_small;
|
||||
int btnSize = iconSize + 2*min_gap;
|
||||
if (btnSize > labelRect.height()) {
|
||||
btnSize = labelRect.height();
|
||||
iconSize = btnSize - 2*min_gap;
|
||||
}
|
||||
plusBtn->setIconSize(QSize(iconSize, iconSize));
|
||||
plusBtn->resize(btnSize, btnSize);
|
||||
connect(plusBtn, SIGNAL(clicked(bool)), this, SIGNAL(addButtonClicked()));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue