Skip to content
Snippets Groups Projects
Commit 78005743 authored by Matthias Puchner's avatar Matthias Puchner Committed by Wuttke, Joachim
Browse files

return correct sizeHint for scientific spin box

parent 98eaa162
No related branches found
No related tags found
1 merge request!708Refactor and simplify UI
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
// ************************************************************************************************ // ************************************************************************************************
#include "GUI/View/PropertyEditor/ScientificSpinBox.h" #include "GUI/View/PropertyEditor/ScientificSpinBox.h"
#include <QDoubleSpinBox>
#include <QLineEdit> #include <QLineEdit>
#include <cmath> #include <cmath>
...@@ -45,6 +46,16 @@ ScientificSpinBox::ScientificSpinBox(QWidget* parent) ...@@ -45,6 +46,16 @@ ScientificSpinBox::ScientificSpinBox(QWidget* parent)
ScientificSpinBox::~ScientificSpinBox() = default; ScientificSpinBox::~ScientificSpinBox() = default;
QSize ScientificSpinBox::sizeHint() const
{
// The following is somehow a hack to get a reasonable sizeHint. Implementation could/should be
// re-thought
QDoubleSpinBox d;
d.setRange(m_min, m_max);
d.setDecimals(m_decimals);
return d.sizeHint();
}
double ScientificSpinBox::value() const double ScientificSpinBox::value() const
{ {
return m_value; return m_value;
......
...@@ -25,6 +25,8 @@ public: ...@@ -25,6 +25,8 @@ public:
ScientificSpinBox(QWidget* parent = nullptr); ScientificSpinBox(QWidget* parent = nullptr);
~ScientificSpinBox() override; ~ScientificSpinBox() override;
QSize sizeHint() const override;
double value() const; double value() const;
void setValue(double val); void setValue(double val);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment