blob: 0a61c9061a151c23b2e291ae72778de45dacaeab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include "mycustomspinbox.h"
MyCustomSpinBox::MyCustomSpinBox(QWidget *parent)
: QSpinBox(parent)
{
}
QString MyCustomSpinBox::textFromValue(int val) const
{
// Determine the desired number of digits (e.g., 2 for "01", "09", "10")
// You can make this dynamic based on the maximum value or a fixed number.
int desiredDigits = 3; // Example: always show at least 3 digits
QString formattedString = QString("%1").arg(val, desiredDigits, 10, QChar('0'));
return formattedString;
}
|