summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx/qfxtextedit.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-05-19 12:19:50 (GMT)
committerLars Knoll <lars.knoll@nokia.com>2009-05-19 12:19:50 (GMT)
commit07c879367e4a8e9038c5eb7d100ed0e4facd9329 (patch)
treea1ac529bf607dc229c0cac9e03ec6e5a5c748837 /src/declarative/fx/qfxtextedit.cpp
parentbfcc49068b99416af2711b48dc5cf6386224345b (diff)
downloadQt-07c879367e4a8e9038c5eb7d100ed0e4facd9329.zip
Qt-07c879367e4a8e9038c5eb7d100ed0e4facd9329.tar.gz
Qt-07c879367e4a8e9038c5eb7d100ed0e4facd9329.tar.bz2
no need to translate graphics events to regular ones
QTextControl can handle graphics mouse events directly, no need to translate them to regular mouse events.
Diffstat (limited to 'src/declarative/fx/qfxtextedit.cpp')
-rw-r--r--src/declarative/fx/qfxtextedit.cpp39
1 files changed, 3 insertions, 36 deletions
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index 35b1173..8667c9e 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -662,7 +662,6 @@ void QFxTextEdit::keyReleaseEvent(QKeyEvent *event)
*/
void QFxTextEdit::focusChanged(bool hasFocus)
{
- Q_D(QFxTextEdit);
setCursorVisible(hasFocus);
}
@@ -675,29 +674,6 @@ void QFxTextEdit::selectAll()
d->control->selectAll();
}
-static QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e)
-{
- QEvent::Type t;
- switch(e->type()) {
- default:
- case QEvent::GraphicsSceneMousePress:
- t = QEvent::MouseButtonPress;
- break;
- case QEvent::GraphicsSceneMouseRelease:
- t = QEvent::MouseButtonRelease;
- break;
- case QEvent::GraphicsSceneMouseMove:
- t = QEvent::MouseMove;
- break;
- case QGraphicsSceneEvent::GraphicsSceneMouseDoubleClick:
- t = QEvent::MouseButtonDblClick;
- break;
- }
-
- QMouseEvent *me = new QMouseEvent(t, e->pos().toPoint(), e->button(), e->buttons(), 0);
- return me;
-}
-
/*!
\overload
Handles the given mouse \a event.
@@ -707,10 +683,7 @@ void QFxTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
Q_D(QFxTextEdit);
if (d->focusOnPress)
setFocus(true);
- QMouseEvent *me = sceneMouseEventToMouseEvent(event);
- d->control->processEvent(me, QPointF(0, 0));
- event->setAccepted(me->isAccepted());
- delete me;
+ d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
QFxPaintedItem::mousePressEvent(event);
}
@@ -722,10 +695,7 @@ Handles the given mouse \a event.
void QFxTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxTextEdit);
- QMouseEvent *me = sceneMouseEventToMouseEvent(event);
- d->control->processEvent(me, QPointF(0, 0));
- event->setAccepted(me->isAccepted());
- delete me;
+ d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
QFxPaintedItem::mousePressEvent(event);
}
@@ -737,10 +707,7 @@ Handles the given mouse \a event.
void QFxTextEdit::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxTextEdit);
- QMouseEvent *me = sceneMouseEventToMouseEvent(event);
- d->control->processEvent(me, QPointF(0, 0));
- event->setAccepted(me->isAccepted());
- delete me;
+ d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
QFxPaintedItem::mousePressEvent(event);
}