File tree Expand file tree Collapse file tree 1 file changed +22
-17
lines changed
Expand file tree Collapse file tree 1 file changed +22
-17
lines changed Original file line number Diff line number Diff line change 2020class AmountSpinBox : public QAbstractSpinBox
2121{
2222 Q_OBJECT
23+
2324public:
2425 explicit AmountSpinBox (QWidget *parent):
2526 QAbstractSpinBox(parent),
@@ -72,23 +73,6 @@ class AmountSpinBox: public QAbstractSpinBox
7273 setValue (val);
7374 }
7475
75- StepEnabled stepEnabled () const
76- {
77- StepEnabled rv = 0 ;
78- if (text ().isEmpty ()) // Allow step-up with empty field
79- return StepUpEnabled;
80- bool valid = false ;
81- CAmount val = value (&valid);
82- if (valid)
83- {
84- if (val > 0 )
85- rv |= StepDownEnabled;
86- if (val < BitcoinUnits::maxMoney ())
87- rv |= StepUpEnabled;
88- }
89- return rv;
90- }
91-
9276 void setDisplayUnit (int unit)
9377 {
9478 bool valid = false ;
@@ -139,6 +123,7 @@ class AmountSpinBox: public QAbstractSpinBox
139123 }
140124 return cachedMinimumSizeHint;
141125 }
126+
142127private:
143128 int currentUnit;
144129 CAmount singleStep;
@@ -179,6 +164,26 @@ class AmountSpinBox: public QAbstractSpinBox
179164 return QAbstractSpinBox::event (event);
180165 }
181166
167+ StepEnabled stepEnabled () const
168+ {
169+ if (isReadOnly ()) // Disable steps when AmountSpinBox is read-only
170+ return StepNone;
171+ if (text ().isEmpty ()) // Allow step-up with empty field
172+ return StepUpEnabled;
173+
174+ StepEnabled rv = 0 ;
175+ bool valid = false ;
176+ CAmount val = value (&valid);
177+ if (valid)
178+ {
179+ if (val > 0 )
180+ rv |= StepDownEnabled;
181+ if (val < BitcoinUnits::maxMoney ())
182+ rv |= StepUpEnabled;
183+ }
184+ return rv;
185+ }
186+
182187signals:
183188 void valueChanged ();
184189};
You can’t perform that action at this time.
0 commit comments