1313// /
1414NumericLineEdit::NumericLineEdit (QWidget* parent)
1515 : QLineEdit(parent)
16- ,_paddingZeroes (false )
17- ,_paddingZeroWidth (0 )
16+ ,_leadingZeroes (false )
17+ ,_leadingZeroWidth (0 )
1818{
1919 setInputMode (Int32Mode);
2020 setValue (0 );
@@ -31,8 +31,8 @@ NumericLineEdit::NumericLineEdit(QWidget* parent)
3131// /
3232NumericLineEdit::NumericLineEdit (NumericLineEdit::InputMode mode, QWidget *parent)
3333 : QLineEdit(parent)
34- ,_paddingZeroes (false )
35- ,_paddingZeroWidth (0 )
34+ ,_leadingZeroes (false )
35+ ,_leadingZeroWidth (0 )
3636{
3737 setInputMode (mode);
3838 setValue (0 );
@@ -43,21 +43,21 @@ NumericLineEdit::NumericLineEdit(NumericLineEdit::InputMode mode, QWidget *paren
4343}
4444
4545// /
46- // / \brief NumericLineEdit::paddingZeroes
46+ // / \brief NumericLineEdit::leadingZeroes
4747// / \return
4848// /
49- bool NumericLineEdit::paddingZeroes () const
49+ bool NumericLineEdit::leadingZeroes () const
5050{
51- return _paddingZeroes ;
51+ return _leadingZeroes ;
5252}
5353
5454// /
5555// / \brief NumberLineEdit::enablePaddingZero
5656// / \param on
5757// /
58- void NumericLineEdit::setPaddingZeroes (bool on)
58+ void NumericLineEdit::setLeadingZeroes (bool on)
5959{
60- _paddingZeroes = on;
60+ _leadingZeroes = on;
6161}
6262
6363// /
@@ -157,9 +157,9 @@ void NumericLineEdit::internalSetValue(QVariant value)
157157 {
158158 case Int32Mode:
159159 value = qBound (_minValue.toInt (), value.toInt (), _maxValue.toInt ());
160- if (_paddingZeroes )
160+ if (_leadingZeroes )
161161 {
162- const auto text = QStringLiteral (" %1" ).arg (value.toInt (), _paddingZeroWidth , 10 , QLatin1Char (' 0' ));
162+ const auto text = QStringLiteral (" %1" ).arg (value.toInt (), _leadingZeroWidth , 10 , QLatin1Char (' 0' ));
163163 if (text != QLineEdit::text ())
164164 QLineEdit::setText (text);
165165 }
@@ -173,9 +173,9 @@ void NumericLineEdit::internalSetValue(QVariant value)
173173
174174 case UInt32Mode:
175175 value = qBound (_minValue.toUInt (), value.toUInt (), _maxValue.toUInt ());
176- if (_paddingZeroes )
176+ if (_leadingZeroes )
177177 {
178- const auto text = QStringLiteral (" %1" ).arg (value.toUInt (), _paddingZeroWidth , 10 , QLatin1Char (' 0' ));
178+ const auto text = QStringLiteral (" %1" ).arg (value.toUInt (), _leadingZeroWidth , 10 , QLatin1Char (' 0' ));
179179 if (text != QLineEdit::text ())
180180 QLineEdit::setText (text);
181181 }
@@ -191,9 +191,9 @@ void NumericLineEdit::internalSetValue(QVariant value)
191191 {
192192 value = qBound (_minValue.toInt () > 0 ? _minValue.toUInt () : 0 , value.toUInt (), _maxValue.toUInt ());
193193 const QString prefix = (hasFocus () ? " " : " 0x" );
194- if (_paddingZeroes )
194+ if (_leadingZeroes )
195195 {
196- const auto text = prefix + QStringLiteral (" %1" ).arg (value.toUInt (), _paddingZeroWidth , 16 , QLatin1Char (' 0' )).toUpper ();
196+ const auto text = prefix + QStringLiteral (" %1" ).arg (value.toUInt (), _leadingZeroWidth , 16 , QLatin1Char (' 0' )).toUpper ();
197197 if (text != QLineEdit::text ())
198198 QLineEdit::setText (text);
199199 }
@@ -236,9 +236,9 @@ void NumericLineEdit::internalSetValue(QVariant value)
236236 case Int64Mode:
237237 {
238238 value = qBound (_minValue.toLongLong (), value.toLongLong (), _maxValue.toLongLong ());
239- if (_paddingZeroes )
239+ if (_leadingZeroes )
240240 {
241- const auto text = QStringLiteral (" %1" ).arg (value.toLongLong (), _paddingZeroWidth , 10 , QLatin1Char (' 0' ));
241+ const auto text = QStringLiteral (" %1" ).arg (value.toLongLong (), _leadingZeroWidth , 10 , QLatin1Char (' 0' ));
242242 if (text != QLineEdit::text ())
243243 QLineEdit::setText (text);
244244 }
@@ -254,9 +254,9 @@ void NumericLineEdit::internalSetValue(QVariant value)
254254 case UInt64Mode:
255255 {
256256 value = qBound (_minValue.toULongLong (), value.toULongLong (), _maxValue.toULongLong ());
257- if (_paddingZeroes )
257+ if (_leadingZeroes )
258258 {
259- const auto text = QStringLiteral (" %1" ).arg (value.toULongLong (), _paddingZeroWidth , 10 , QLatin1Char (' 0' ));
259+ const auto text = QStringLiteral (" %1" ).arg (value.toULongLong (), _leadingZeroWidth , 10 , QLatin1Char (' 0' ));
260260 if (text != QLineEdit::text ())
261261 QLineEdit::setText (text);
262262 }
@@ -493,7 +493,7 @@ void NumericLineEdit::on_rangeChanged(const QVariant& bottom, const QVariant& to
493493 case Int32Mode:
494494 {
495495 const int nums = QString::number (top.toInt ()).length ();
496- _paddingZeroWidth = qMax (1 , nums);
496+ _leadingZeroWidth = qMax (1 , nums);
497497 setMaxLength (qMax (2 , nums + 1 ));
498498 setValidator (new QIntValidator (bottom.toInt (), top.toInt (), this ));
499499
@@ -503,7 +503,7 @@ void NumericLineEdit::on_rangeChanged(const QVariant& bottom, const QVariant& to
503503 case UInt32Mode:
504504 {
505505 const int nums = QString::number (top.toUInt ()).length ();
506- _paddingZeroWidth = qMax (1 , nums);
506+ _leadingZeroWidth = qMax (1 , nums);
507507 setMaxLength (qMax (1 , nums));
508508 setValidator (new QUIntValidator (bottom.toUInt (), top.toUInt (), this ));
509509 }
@@ -512,7 +512,7 @@ void NumericLineEdit::on_rangeChanged(const QVariant& bottom, const QVariant& to
512512 case HexMode:
513513 {
514514 const int nums = QString::number (top.toUInt (), 16 ).length ();
515- _paddingZeroWidth = qMax (1 , nums);
515+ _leadingZeroWidth = qMax (1 , nums);
516516 setMaxLength (qMax (1 , nums + 2 ));
517517 setValidator (new QHexValidator (bottom.toUInt (), top.toUInt (), this ));
518518 }
@@ -531,7 +531,7 @@ void NumericLineEdit::on_rangeChanged(const QVariant& bottom, const QVariant& to
531531 case Int64Mode:
532532 {
533533 const int nums = QString::number (top.toLongLong ()).length ();
534- _paddingZeroWidth = qMax (1 , nums);
534+ _leadingZeroWidth = qMax (1 , nums);
535535 setMaxLength (qMax (2 , nums + 1 ));
536536 setValidator (new QInt64Validator (bottom.toLongLong (), top.toLongLong (), this ));
537537 }
@@ -540,7 +540,7 @@ void NumericLineEdit::on_rangeChanged(const QVariant& bottom, const QVariant& to
540540 case UInt64Mode:
541541 {
542542 const int nums = QString::number (top.toULongLong ()).length ();
543- _paddingZeroWidth = qMax (1 , nums);
543+ _leadingZeroWidth = qMax (1 , nums);
544544 setMaxLength (qMax (1 , nums));
545545 setValidator (new QUIntValidator (bottom.toULongLong (), top.toULongLong (), this ));
546546 }
0 commit comments