Gui: don't make QuantitySpinBox dependent on implementation details of its base class
This commit is contained in:
@@ -337,8 +337,11 @@ QuantitySpinBox::~QuantitySpinBox()
|
||||
|
||||
void QuantitySpinBox::bind(const App::ObjectIdentifier &_path)
|
||||
{
|
||||
ExpressionBinding::bind(_path);
|
||||
ExpressionSpinBox::bind(_path);
|
||||
}
|
||||
|
||||
void QuantitySpinBox::showIcon()
|
||||
{
|
||||
iconLabel->show();
|
||||
}
|
||||
|
||||
|
||||
@@ -145,6 +145,7 @@ protected Q_SLOTS:
|
||||
protected:
|
||||
void setExpression(std::shared_ptr<App::Expression> expr) override;
|
||||
void openFormulaDialog() override;
|
||||
void showIcon() override;
|
||||
StepEnabled stepEnabled() const override;
|
||||
void showEvent(QShowEvent * event) override;
|
||||
void hideEvent(QHideEvent * event) override;
|
||||
|
||||
@@ -65,6 +65,11 @@ void ExpressionSpinBox::bind(const App::ObjectIdentifier &_path)
|
||||
{
|
||||
ExpressionBinding::bind(_path);
|
||||
|
||||
showIcon();
|
||||
}
|
||||
|
||||
void ExpressionSpinBox::showIcon()
|
||||
{
|
||||
int frameWidth = spinbox->style()->pixelMetric(QStyle::PM_SpinBoxFrameWidth);
|
||||
lineedit->setStyleSheet(QString::fromLatin1("QLineEdit { padding-right: %1px } ").arg(iconLabel->sizeHint().width() + frameWidth + 1));
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ protected:
|
||||
|
||||
void onChange() override;
|
||||
virtual void setNumberExpression(App::NumberExpression*) = 0;
|
||||
virtual void showIcon();
|
||||
void resizeWidget();
|
||||
|
||||
bool handleKeyEvent(const QString&);
|
||||
|
||||
Reference in New Issue
Block a user