diff options
Diffstat (limited to 'src/widgets/widgets/qlineedit.cpp')
-rw-r--r-- | src/widgets/widgets/qlineedit.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index d6db6dd5bc..055412528f 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -601,9 +601,17 @@ const QValidator * QLineEdit::validator() const } /*! - Sets this line edit to only accept input that the validator, \a v, - will accept. This allows you to place any arbitrary constraints on - the text which may be entered. + Sets the validator for values of line edit to \a v. + + The line edit's returnPressed() and editingFinished() signals will only + be emitted if \a v validates the line edit's content as \l{QValidator::}{Acceptable}. + The user may change the content to any \l{QValidator::}{Intermediate} + value during editing, but will be prevented from editing the text to a + value that \a v validates as \l{QValidator::}{Invalid}. + + This allows you to constrain the text that shall finally be entered when editing is + done, while leaving users with enough freedom to edit the text from one valid state + to another. If \a v == 0, setValidator() removes the current input validator. The initial setting is to have no input validator (i.e. any input @@ -703,7 +711,7 @@ QSize QLineEdit::sizeHint() const /*! Returns a minimum size for the line edit. - The width returned is enough for at least one character. + The width returned is usually enough for at least one character. */ QSize QLineEdit::minimumSizeHint() const @@ -715,7 +723,7 @@ QSize QLineEdit::minimumSizeHint() const int h = fm.height() + qMax(2 * QLineEditPrivate::verticalMargin, fm.leading()) + tm.top() + tm.bottom() + d->topmargin + d->bottommargin; - int w = fm.maxWidth() + int w = fm.maxWidth() + 2 * QLineEditPrivate::horizontalMargin + tm.left() + tm.right() + d->leftmargin + d->rightmargin; QStyleOptionFrame opt; @@ -1441,7 +1449,7 @@ void QLineEdit::copy() const Inserts the clipboard's text at the cursor position, deleting any selected text, providing the line edit is not \l{QLineEdit::readOnly}{read-only}. - If the end result would not be acceptable to the current + If the end result would be invalid to the current \l{setValidator()}{validator}, nothing happens. \sa copy(), cut() |