diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-12-02 10:44:40 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-12-10 09:36:24 +0100 |
commit | 95689c645fb42260d920091658b2d39c920abf00 (patch) | |
tree | d5381531025977bf463ac54c018c237dd90e4264 /src/widgets/widgets | |
parent | c69a2448ab129d88411a4778f2350dcf971dc623 (diff) |
Make inputmask 'X' mask character require non-blank input
The implementation for the X mask would accept any printable
character. Since that includes the blank character, there was no
difference in behavior between the requiring X and optional x: both
would allow the input to be unset, i.e. blank.
This change should be seen in conjunction with the doc improvement
da0af1e.
[ChangeLog][QtWidgets][QLineEdit] Inputmask X character now requires non-blank input.
Fixes: QTBUG-76320
Change-Id: I3e0363e9be5c13373a157cce69c99379615b5829
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r-- | src/widgets/widgets/qlineedit.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index bcd6614ee4..19a95be0ff 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -1214,8 +1214,8 @@ QMargins QLineEdit::textMargins() const \row \li \c a \li ASCII alphabetic character permitted but not required. \row \li \c N \li ASCII alphanumeric character required. A-Z, a-z, 0-9. \row \li \c n \li ASCII alphanumeric character permitted but not required. - \row \li \c X \li Any character required. - \row \li \c x \li Any character permitted but not required. + \row \li \c X \li Any non-blank character required. + \row \li \c x \li Any non-blank character permitted but not required. \row \li \c 9 \li ASCII digit required. 0-9. \row \li \c 0 \li ASCII digit permitted but not required. \row \li \c D \li ASCII digit required. 1-9. diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index a242947c11..9dd61c2c6a 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -1090,7 +1090,7 @@ bool QWidgetLineControl::isValidInput(QChar key, QChar mask) const return true; break; case 'X': - if (key.isPrint()) + if (key.isPrint() && key != m_blank) return true; break; case 'x': |