Gui: fix spinbox numbers should not go under the icon
This commit is contained in:
committed by
Kacper Donat
parent
6693947ca1
commit
1012b66f4f
@@ -282,14 +282,6 @@ QuantitySpinBox::QuantitySpinBox(QWidget *parent)
|
||||
this, [&]{
|
||||
this->handlePendingEmit(true);
|
||||
});
|
||||
|
||||
// When a style sheet is set the text margins for top/bottom must be set to avoid to squash the widget
|
||||
#ifndef Q_OS_MAC
|
||||
lineEdit()->setTextMargins(0, 2, 0, 2);
|
||||
#else
|
||||
// https://forum.freecad.org/viewtopic.php?f=8&t=50615
|
||||
lineEdit()->setTextMargins(0, 2, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
QuantitySpinBox::~QuantitySpinBox() = default;
|
||||
|
||||
@@ -54,6 +54,14 @@ ExpressionSpinBox::ExpressionSpinBox(QAbstractSpinBox* sb)
|
||||
QObject::connect(iconLabel, &ExpressionLabel::clicked, [this]() {
|
||||
this->openFormulaDialog();
|
||||
});
|
||||
|
||||
// Set Margins
|
||||
// vertical to avoid this: https://forum.freecad.org/viewtopic.php?f=8&t=50615
|
||||
// horizontal to avoid going under the icon
|
||||
lineedit->setAlignment(Qt::AlignVCenter);
|
||||
int iconWidth = iconLabel->sizeHint().width();
|
||||
int margin = lineedit->style()->pixelMetric(QStyle::PM_LineEditIconMargin, nullptr, lineedit);
|
||||
lineedit->setTextMargins(margin, margin, margin + iconWidth, margin);
|
||||
}
|
||||
|
||||
ExpressionSpinBox::~ExpressionSpinBox() = default;
|
||||
|
||||
Reference in New Issue
Block a user