Make setRange methods in QValidator subclasses non-virtual

As per the FIXME comment. These functions are not called by Qt, so no
reason to have them virtual.

As a drive-by, remove redundant virtual keyword from overrides.

[ChangeLog][QtGui][QValidator] QIntValidator::setRange and
QDoubleValidator::setRange are no longer declared as virtual.

Change-Id: I640646fb18ed50554e384ed67ac85b3f408ea8cc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-04-02 14:20:16 +02:00
parent af6f3cb317
commit de78425ca0
2 changed files with 3 additions and 7 deletions

View File

@ -456,8 +456,6 @@ void QIntValidator::fixup(QString &input) const
input = locale().toString(entered);
}
// FIXME: Qt 6: Make QIntValidator::setRange() non-virtual
/*!
Sets the range of the validator to only accept integers between \a
bottom and \a top inclusive.
@ -708,8 +706,6 @@ QValidator::State QDoubleValidatorPrivate::validateWithLocale(QString &input, QL
return QValidator::Intermediate;
}
// FIXME: Qt 6: Make QDoubleValidator::setRange() non-virtual
/*!
Sets the validator to accept doubles from \a minimum to \a maximum
inclusive, with at most \a decimals digits after the decimal

View File

@ -104,7 +104,7 @@ public:
void setBottom(int);
void setTop(int);
virtual void setRange(int bottom, int top);
void setRange(int bottom, int top);
int bottom() const { return b; }
int top() const { return t; }
@ -141,7 +141,7 @@ public:
Q_ENUM(Notation)
QValidator::State validate(QString &, int &) const override;
virtual void setRange(double bottom, double top, int decimals = 0);
void setRange(double bottom, double top, int decimals = 0);
void setBottom(double);
void setTop(double);
void setDecimals(int);
@ -181,7 +181,7 @@ public:
explicit QRegularExpressionValidator(const QRegularExpression &re, QObject *parent = nullptr);
~QRegularExpressionValidator();
virtual QValidator::State validate(QString &input, int &pos) const override;
QValidator::State validate(QString &input, int &pos) const override;
QRegularExpression regularExpression() const;