Gui: spinbox use getmargin

This commit is contained in:
Alfredo Monclus
2025-03-19 07:50:20 -03:00
committed by Kacper Donat
parent ad95704832
commit 02f37bf598

View File

@@ -68,7 +68,6 @@ ExpressionSpinBox::~ExpressionSpinBox() = default;
int ExpressionSpinBox::getMargin()
{
lineedit = spinbox->findChild<QLineEdit*>();
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
return lineedit->style()->pixelMetric(QStyle::PM_LineEditIconMargin, nullptr, lineedit) / 2;
#else
@@ -179,12 +178,7 @@ void ExpressionSpinBox::onChange()
void ExpressionSpinBox::resizeWidget()
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
int margin = lineedit->style()->pixelMetric(QStyle::PM_LineEditIconMargin, nullptr, lineedit) / 2;
#else
int margin = lineedit->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, lineedit);
#endif
int iconWidth = iconLabel->width() + margin;
int iconWidth = iconLabel->width() + getMargin();
iconLabel->move(lineedit->width() - iconWidth, (lineedit->height() - iconLabel->height()) / 2);
updateExpression();
}