summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-07-08 23:47:18 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-07-08 23:47:18 (GMT)
commitb9fc86cd9f51c80a1103e5e896940b49bf552b07 (patch)
tree4b99ada73a8244afaee1191f57da4a1ffddaa5b1
parent3528101647e7320d07623e659138005d7d603980 (diff)
downloadQt-b9fc86cd9f51c80a1103e5e896940b49bf552b07.zip
Qt-b9fc86cd9f51c80a1103e5e896940b49bf552b07.tar.gz
Qt-b9fc86cd9f51c80a1103e5e896940b49bf552b07.tar.bz2
Accidental Behavioural changes have been identified and rectified.
createStandardContextMenu should still only cut/copy in normal echo mode and the Qt3Support function validateAndSet will again only set if it is validated.
-rw-r--r--src/gui/widgets/qlineedit.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 8e7fdec..2d6ef03 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -692,9 +692,14 @@ int QLineEdit::cursorPositionAt(const QPoint &pos)
bool QLineEdit::validateAndSet(const QString &newText, int newPos,
int newMarkAnchor, int newMarkDrag)
{
- // Note, this doesn't validate', but then neither
- // does the suggested functions above in the docs.
+ // The suggested functions above in the docs don't seem to validate,
+ // below code tries to mimic previous behaviour.
+ QString oldText = text();
setText(newText);
+ if(!hasAcceptableInput()){
+ setText(oldText);
+ return false;
+ }
setCursorPosition(newPos);
setSelection(qMin(newMarkAnchor, newMarkDrag), qAbs(newMarkAnchor - newMarkDrag));
return true;
@@ -1947,11 +1952,13 @@ QMenu *QLineEdit::createStandardContextMenu()
#ifndef QT_NO_CLIPBOARD
action = popup->addAction(QLineEdit::tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut));
- action->setEnabled(!d->control->isReadOnly() && d->control->hasSelectedText());
+ action->setEnabled(!d->control->isReadOnly() && d->control->hasSelectedText()
+ && d->control->echoMode() == QLineEdit::Normal);
connect(action, SIGNAL(triggered()), SLOT(cut()));
action = popup->addAction(QLineEdit::tr("&Copy") + ACCEL_KEY(QKeySequence::Copy));
- action->setEnabled(d->control->hasSelectedText());
+ action->setEnabled(d->control->hasSelectedText()
+ && d->control->echoMode() == QLineEdit::Normal);
connect(action, SIGNAL(triggered()), SLOT(copy()));
action = popup->addAction(QLineEdit::tr("&Paste") + ACCEL_KEY(QKeySequence::Paste));