summaryrefslogtreecommitdiffstats
path: root/src/datavis3dqml2/declarativebars.cpp
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-06-18 11:56:23 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-06-18 12:20:56 +0300
commit436f8747d5a51aef89bf8ffb55fca475ea3d5d60 (patch)
tree1fdba50c27dad13a3a2df3aefbbe9c9515746857 /src/datavis3dqml2/declarativebars.cpp
parentde9e7fe163ec3e4aca5216aaf9d85de5e8154509 (diff)
Convert mouse position from QML to Qt coordinates
QML has (0, 0) at bottom left, Qt at top left. For rotating to work correctly on both, we need to convert QML mouse coordinates before passing them to renderer. Change-Id: Ic85fbaec2f75c0432f81dfb48070f7ab598c8e00 Reviewed-by: Pasi Keränen <pasi.keranen@digia.com>
Diffstat (limited to 'src/datavis3dqml2/declarativebars.cpp')
-rw-r--r--src/datavis3dqml2/declarativebars.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/datavis3dqml2/declarativebars.cpp b/src/datavis3dqml2/declarativebars.cpp
index 4402e147..dfcb5ba2 100644
--- a/src/datavis3dqml2/declarativebars.cpp
+++ b/src/datavis3dqml2/declarativebars.cpp
@@ -62,7 +62,7 @@ DeclarativeBars::DeclarativeBars(QQuickItem *parent)
setAcceptedMouseButtons(Qt::AllButtons);
// TODO: Note; this does not flip the render result correctly. It is in mirror image.
- setRotation(180.0);
+ //setRotation(180.0);
// TODO: These seem to have no effect; find a way to activate anti-aliasing
setAntialiasing(true);
@@ -349,17 +349,23 @@ void DeclarativeBars::setMeshFileName(const QString &objFileName)
void DeclarativeBars::mousePressEvent(QMouseEvent *event)
{
- m_shared->mousePressEvent(event);
+ QPoint mousePos = event->pos();
+ mousePos.setY(height() - mousePos.y());
+ m_shared->mousePressEvent(event, mousePos);
}
void DeclarativeBars::mouseReleaseEvent(QMouseEvent *event)
{
- m_shared->mouseReleaseEvent(event);
+ QPoint mousePos = event->pos();
+ mousePos.setY(height() - mousePos.y());
+ m_shared->mouseReleaseEvent(event, mousePos);
}
void DeclarativeBars::mouseMoveEvent(QMouseEvent *event)
{
- m_shared->mouseMoveEvent(event);
+ QPoint mousePos = event->pos();
+ mousePos.setY(height() - mousePos.y());
+ m_shared->mouseMoveEvent(event, mousePos);
}
void DeclarativeBars::wheelEvent(QWheelEvent *event)
@@ -396,13 +402,6 @@ void DeclarativeBarsRenderer::render()
m_fbo->bind();
- // SGRendering State resets between calls...
-// glDepthMask(true);
-// glEnable(GL_DEPTH_TEST);
-// glDepthFunc(GL_LESS);
-// glEnable(GL_CULL_FACE);
-// glCullFace(GL_BACK);
-
// Call the shared rendering function
m_barsRenderer->render(m_fbo->handle());