From: Lars Knoll Date: Wed, 7 Sep 2011 19:55:47 +0000 (+0200) Subject: Ensure the itemTransform in QInputPanel is always up to date X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=a41e073fca65671a370c6a4800310caad3ae75e8;p=konrad%2Fqtdeclarative.git Ensure the itemTransform in QInputPanel is always up to date Hook into the render loop and update the itemTransform in the QInputPanel before we repaint. Change-Id: If9122ba0fbe31cff3bfcc3edc48f684cc9b16984 Reviewed-on: http://codereview.qt-project.org/4405 Reviewed-by: Qt Sanity Bot Reviewed-by: Vesa Rantanen Reviewed-by: Gunnar Sletta --- diff --git a/src/declarative/items/qsgcanvas.cpp b/src/declarative/items/qsgcanvas.cpp index 979fc16..6e81656 100644 --- a/src/declarative/items/qsgcanvas.cpp +++ b/src/declarative/items/qsgcanvas.cpp @@ -70,6 +70,13 @@ DEFINE_BOOL_CONFIG_OPTION(qmlNoThreadedRenderer, QML_BAD_GUI_RENDER_LOOP) extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha); +void QSGCanvasRenderLoop::updateFocusItemTransform() +{ + QSGItem *focus = renderer->activeFocusItem(); + if (focus && qApp->inputPanel()->inputItem() == focus) + qApp->inputPanel()->setInputItemTranform(QSGItemPrivate::get(focus)->itemToCanvasTransform()); +} + class QSGCanvasPlainRenderLoop : public QObject, public QSGCanvasRenderLoop { public: @@ -85,6 +92,7 @@ public: virtual void paint() { if (animationRunning && animationDriver()) animationDriver()->advance(); + updateFocusItemTransform(); syncSceneGraph(); makeCurrent(); glViewport(0, 0, size.width(), size.height()); @@ -2030,6 +2038,7 @@ void QSGCanvasRenderThread::sync(bool guiAlreadyLocked) renderThreadAwakened = false; polishItems(); + updateFocusItemTransform(); wake(); wait(); diff --git a/src/declarative/items/qsgcanvas_p.h b/src/declarative/items/qsgcanvas_p.h index acd52a8..b0c63f0 100644 --- a/src/declarative/items/qsgcanvas_p.h +++ b/src/declarative/items/qsgcanvas_p.h @@ -68,6 +68,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -204,6 +205,7 @@ protected: void renderSceneGraph(const QSize &size) { d->renderSceneGraph(size); } void polishItems() { d->polishItems(); } QAnimationDriver *animationDriver() const { return d->animationDriver; } + void updateFocusItemTransform(); inline QOpenGLContext *glContext() const { return gl; } void createGLContext();