summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-04-27 05:43:57 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-04-27 05:43:57 (GMT)
commitf8fea6f3b8fd3a1baa256130b23efc9e67a40e21 (patch)
treec9eee3ff39000816113bcab3a5c035da97c2a9fc /src/declarative/graphicsitems
parent415951891cd75170f1e4b89b46effa3319b56e4e (diff)
parent47712d1f330e4b22ce6dd30e7557288ef7f7fca0 (diff)
downloadQt-f8fea6f3b8fd3a1baa256130b23efc9e67a40e21.zip
Qt-f8fea6f3b8fd3a1baa256130b23efc9e67a40e21.tar.gz
Qt-f8fea6f3b8fd3a1baa256130b23efc9e67a40e21.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Ignore changes to selectByMouse during a selection. PathView offset out of sync with currentIndex when items are removed.
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp11
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput_p_p.h4
3 files changed, 13 insertions, 4 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 778b8b9..aed849b 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -1525,6 +1525,8 @@ void QDeclarativePathView::itemsRemoved(int modelIndex, int count)
} else {
d->regenerate();
d->updateCurrent();
+ if (!d->flicking && !d->moving && d->haveHighlightRange && d->highlightRangeMode == QDeclarativePathView::StrictlyEnforceRange)
+ d->snapToCurrent();
}
if (changedOffset)
emit offsetChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 6eb6b68..9a91769 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -1168,9 +1168,10 @@ void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
if (d->selectByMouse) {
setKeepMouseGrab(false);
+ d->selectPressed = true;
d->pressPos = event->pos();
}
- bool mark = event->modifiers() & Qt::ShiftModifier;
+ bool mark = (event->modifiers() & Qt::ShiftModifier) && d->selectByMouse;
int cursor = d->xToPos(event->pos().x());
d->control->moveCursor(cursor, mark);
event->setAccepted(true);
@@ -1181,7 +1182,7 @@ void QDeclarativeTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Q_D(QDeclarativeTextInput);
if (d->sendMouseEventToInputContext(event, QEvent::MouseMove))
return;
- if (d->selectByMouse) {
+ if (d->selectPressed) {
if (qAbs(int(event->pos().x() - d->pressPos.x())) > QApplication::startDragDistance())
setKeepMouseGrab(true);
moveCursorSelection(d->xToPos(event->pos().x()), d->mouseSelectionMode);
@@ -1200,8 +1201,10 @@ void QDeclarativeTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Q_D(QDeclarativeTextInput);
if (d->sendMouseEventToInputContext(event, QEvent::MouseButtonRelease))
return;
- if (d->selectByMouse)
+ if (d->selectPressed) {
+ d->selectPressed = false;
setKeepMouseGrab(false);
+ }
if (!d->showInputPanelOnFocus) { // input panel on click
if (d->focusOnPress && !isReadOnly() && boundingRect().contains(event->pos())) {
if (QGraphicsView * view = qobject_cast<QGraphicsView*>(qApp->focusWidget())) {
@@ -1257,8 +1260,10 @@ bool QDeclarativeTextInputPrivate::sendMouseEventToInputContext(
bool QDeclarativeTextInput::sceneEvent(QEvent *event)
{
+ Q_D(QDeclarativeTextInput);
bool rv = QDeclarativeItem::sceneEvent(event);
if (event->type() == QEvent::UngrabMouse) {
+ d->selectPressed = false;
setKeepMouseGrab(false);
}
return rv;
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
index ed53e8f..f6f6bd8 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
@@ -76,7 +76,8 @@ public:
mouseSelectionMode(QDeclarativeTextInput::SelectCharacters), inputMethodHints(Qt::ImhNone),
hscroll(0), oldScroll(0), oldValidity(false), focused(false), focusOnPress(true),
showInputPanelOnFocus(true), clickCausedFocus(false), cursorVisible(false),
- autoScroll(true), selectByMouse(false), canPaste(false), hAlignImplicit(true)
+ autoScroll(true), selectByMouse(false), canPaste(false), hAlignImplicit(true),
+ selectPressed(false)
{
#ifdef Q_OS_SYMBIAN
if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) {
@@ -142,6 +143,7 @@ public:
bool selectByMouse:1;
bool canPaste:1;
bool hAlignImplicit:1;
+ bool selectPressed:1;
static inline QDeclarativeTextInputPrivate *get(QDeclarativeTextInput *t) {
return t->d_func();