[prev in list] [next in list] [prev in thread] [next in thread] 

List:       meego-commits
Subject:    [meego-commits] 22040: Changes to MeeGo:1.2:oss:Testing/qt
From:       Andy Ross <no_reply () build ! meego ! com>
Date:       2011-06-30 21:53:52
Message-ID: 20110630215352.0ABD610A272 () mail ! meego ! com
[Download RAW message or body]

Hi,
I have made the following changes to qt in project MeeGo:1.2:oss:Testing. Please \
review and accept ASAP.

Thank You,
Andy Ross

[This message was auto-generated]

---

Request #22040:

  submit:   home:andyross:branches:MeeGo:1.2:oss/qt(r6)(update) -> \
MeeGo:1.2:oss:Testing/qt


Message:
    Backport upstream fix to QML TextInput needed for VKB.  BMC#20410

State:   new          2011-06-30T14:53:37 andyross
Comment: None



changes files:
--------------
--- qt.changes
+++ qt.changes
@@ -0,0 +1,4 @@
+* Wed Jun 29 2011 Andy Ross <andy.ross@windriver.com> - 4.7.2
+- Backport upstream fix for QML TextEdit not calling
+  QInputContext::mouseHandler() (BOO#9783, BMC#20410)
+

new:
----
  qml-textinput-mousehandler.patch

spec files:
-----------
--- qt.spec
+++ qt.spec
@@ -61,6 +61,7 @@
 Patch26:        force_cxxflags_on_armv7l.patch
 Patch27:        change_defaultChannelCount.patch
 Patch28:	qt-make-use-of-shared-KSM-memory.patch
+Patch29:	qml-textinput-mousehandler.patch
 BuildRequires:  cups-devel
 BuildRequires:  fdupes
 BuildRequires:  flex
@@ -565,6 +566,7 @@
 %endif
 %patch27 -p1 -b .change_defaultChannelCount
 %patch28 -p1 -b .qt_sharable
+%patch29 -p1 -b .qml-textinput-mousehandler
 
 %build
 export QTDIR=`pwd`

other changes:
--------------

++++++ qml-textinput-mousehandler.patch (new)
--- qml-textinput-mousehandler.patch
+++ qml-textinput-mousehandler.patch
+From cdceb4283aeacff4c522f94998e09e22f8d7b80b Mon Sep 17 00:00:00 2001
+From: Andrew den Exter <andrew.den-exter@nokia.com>
+Date: Wed, 29 Jun 2011 11:40:25 -0700
+Subject: [PATCH] Forward mouse events from TextInput and TextEdit to
+ QInputContext.
+
+This brings TextInput in line with QLineEdit.  The fix for TextEdit
+applies equally to QTextEdit.
+
+(Backport of Qt commit 521a9bba to 4.7.2 by Andy Ross.  Required so that
+QML TextInput components properly report clicks through to the input
+method.)
+
+Change-Id: I5c47e5c8e951ee53cb1fe45d9c302050cd19deef
+Task-number: QTBUG-15705
+Reviewed-by: axis
+Signed-off-by: Andy Ross <andy.ross@windriver.com>
+---
+ .../graphicsitems/qdeclarativetextedit.cpp         |   38 +++----
+ .../graphicsitems/qdeclarativetextinput.cpp        |   47 ++++++++
+ .../graphicsitems/qdeclarativetextinput_p_p.h      |    1 +
+ src/gui/text/qtextcontrol.cpp                      |  120 +++++++++++++------
+ src/gui/text/qtextcontrol_p_p.h                    |   20 +++-
+ 5 files changed, 165 insertions(+), 61 deletions(-)
+
+diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp \
b/src/declarative/graphicsitems/qdeclarativetextedit.cpp +index 9f77694..394c68a \
100644 +--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
++++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+@@ -887,6 +887,10 @@ void QDeclarativeTextEdit::setSelectByMouse(bool on)
+     Q_D(QDeclarativeTextEdit);
+     if (d->selectByMouse != on) {
+         d->selectByMouse = on;
++        if (on)
++            setTextInteractionFlags(d->control->textInteractionFlags() | \
Qt::TextSelectableByMouse); ++        else
++            setTextInteractionFlags(d->control->textInteractionFlags() & \
~Qt::TextSelectableByMouse); +         emit selectByMouseChanged(on);
+     }
+ }
+@@ -909,11 +913,11 @@ void QDeclarativeTextEdit::setReadOnly(bool r)
+ 
+ 
+     Qt::TextInteractionFlags flags = Qt::NoTextInteraction;
+-    if (r) {
+-        flags = Qt::TextSelectableByMouse;
+-    } else {
+-        flags = Qt::TextEditorInteraction;
+-    }
++    if (d->selectByMouse)
++        flags = flags | Qt::TextSelectableByMouse;
++    if (!r)
++        flags = flags | Qt::TextSelectableByKeyboard | Qt::TextEditable;
++
+     d->control->setTextInteractionFlags(flags);
+     if (!r)
+         d->control->moveCursor(QTextCursor::End);
+@@ -1118,8 +1122,8 @@ void \
QDeclarativeTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) +             \
} +         }
+     }
+-    if (event->type() != QEvent::GraphicsSceneMouseDoubleClick || d->selectByMouse)
+-        d->control->processEvent(event, QPointF(0, -d->yoff));
++
++    d->control->processEvent(event, QPointF(0, -d->yoff));
+     if (!event->isAccepted())
+         QDeclarativePaintedItem::mousePressEvent(event);
+ }
+@@ -1154,13 +1158,11 @@ Handles the given mouse \a event.
+ void QDeclarativeTextEdit::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+ {
+     Q_D(QDeclarativeTextEdit);
+-    if (d->selectByMouse) {
+-        d->control->processEvent(event, QPointF(0, -d->yoff));
+-        if (!event->isAccepted())
+-            QDeclarativePaintedItem::mouseDoubleClickEvent(event);
+-    } else {
++
++    d->control->processEvent(event, QPointF(0, -d->yoff));
++    if (!event->isAccepted())
+         QDeclarativePaintedItem::mouseDoubleClickEvent(event);
+-    }
++
+ }
+ 
+ /*!
+@@ -1170,14 +1172,9 @@ Handles the given mouse \a event.
+ void QDeclarativeTextEdit::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+ {
+     Q_D(QDeclarativeTextEdit);
+-    if (d->selectByMouse) {
+-        d->control->processEvent(event, QPointF(0, -d->yoff));
+-        if (!event->isAccepted())
+-            QDeclarativePaintedItem::mouseMoveEvent(event);
+-        event->setAccepted(true);
+-    } else {
++    d->control->processEvent(event, QPointF(0, -d->yoff));
++    if (!event->isAccepted())
+         QDeclarativePaintedItem::mouseMoveEvent(event);
+-    }
+ }
+ 
+ /*!
+@@ -1261,6 +1258,7 @@ void QDeclarativeTextEditPrivate::init()
+ 
+     control = new QTextControl(q);
+     control->setIgnoreUnusedNavigationEvents(true);
++    control->setTextInteractionFlags(Qt::LinksAccessibleByMouse | \
Qt::TextSelectableByKeyboard | Qt::TextEditable); + 
+     // QTextControl follows the default text color
+     // defined by the platform, declarative text
+diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp \
b/src/declarative/graphicsitems/qdeclarativetextinput.cpp +index 738e8bc..34631f7 \
100644 +--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
++++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+@@ -50,6 +50,7 @@
+ #include <QApplication>
+ #include <QFontMetrics>
+ #include <QPainter>
++#include <QInputContext>
+ 
+ #ifndef QT_NO_LINEEDIT
+ 
+@@ -966,6 +967,8 @@ Handles the given mouse \a event.
+ void QDeclarativeTextInput::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+ {
+     Q_D(QDeclarativeTextInput);
++    if (d->sendMouseEventToInputContext(event, QEvent::MouseButtonDblClick))
++        return;
+     if (d->selectByMouse) {
+         int cursor = d->xToPos(event->pos().x());
+         d->control->selectWordAtPos(cursor);
+@@ -978,6 +981,8 @@ void \
QDeclarativeTextInput::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *even + void \
QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) + {
+     Q_D(QDeclarativeTextInput);
++    if (d->sendMouseEventToInputContext(event, QEvent::MouseButtonPress))
++        return;
+     if(d->focusOnPress){
+         bool hadActiveFocus = hasActiveFocus();
+         forceActiveFocus();
+@@ -1001,6 +1006,8 @@ void \
QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) + void \
QDeclarativeTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event) + {
+     Q_D(QDeclarativeTextInput);
++    if (d->sendMouseEventToInputContext(event, QEvent::MouseMove))
++        event->setAccepted(true);
+     if (d->selectByMouse) {
+         d->control->moveCursor(d->xToPos(event->pos().x()), true);
+         event->setAccepted(true);
+@@ -1016,6 +1023,8 @@ Handles the given mouse \a event.
+ void QDeclarativeTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+ {
+     Q_D(QDeclarativeTextInput);
++    if (d->sendMouseEventToInputContext(event, QEvent::MouseButtonRelease))
++        return;
+     if (!d->showInputPanelOnFocus) { // input panel on click
+         if (d->focusOnPress && !isReadOnly() && \
boundingRect().contains(event->pos())) { +             if (QGraphicsView * view = \
qobject_cast<QGraphicsView*>(qApp->focusWidget())) { +@@ -1031,6 +1040,44 @@ void \
QDeclarativeTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +         \
QDeclarativePaintedItem::mouseReleaseEvent(event); + }
+ 
++bool QDeclarativeTextInputPrivate::sendMouseEventToInputContext(
++        QGraphicsSceneMouseEvent *event, QEvent::Type eventType)
++{
++#if !defined QT_NO_IM
++    if (event->widget() && control->composeMode()) {
++        int tmp_cursor = xToPos(event->pos().x());
++        int mousePos = tmp_cursor - control->cursor();
++        if (mousePos < 0 || mousePos > control->preeditAreaText().length()) {
++            mousePos = -1;
++            // don't send move events outside the preedit area
++            if (eventType == QEvent::MouseMove)
++                return true;
++        }
++
++        QInputContext *qic = event->widget()->inputContext();
++        if (qic) {
++            QMouseEvent mouseEvent(
++                    eventType,
++                    event->widget()->mapFromGlobal(event->screenPos()),
++                    event->screenPos(),
++                    event->button(),
++                    event->buttons(),
++                    event->modifiers());
++            // may be causing reset() in some input methods
++            qic->mouseHandler(mousePos, &mouseEvent);
++            event->setAccepted(mouseEvent.isAccepted());
++        }
++        if (!control->preeditAreaText().isEmpty())
++            return true;
++    }
++#else
++    Q_UNUSED(event);
++    Q_UNUSED(eventType)
++#endif
++
(278 more lines skipped)

_______________________________________________
MeeGo-commits mailing list
MeeGo-commits@meego.com
http://lists.meego.com/listinfo/meego-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic