Adapted for wrap/qt/trackball.h

This commit is contained in:
Paolo Cignoni 2007-11-01 11:33:06 +00:00
parent ab34926b9f
commit da55f73367
2 changed files with 7 additions and 35 deletions

View File

@ -24,11 +24,15 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.1 2007/10/18 08:52:06 benedetti
Initial release.
****************************************************************************/ ****************************************************************************/
#include <QtGui> #include <QtGui>
#include "glarea.h" #include "glarea.h"
#include <wrap/qt/trackball.h>
GLArea::GLArea (QWidget * parent) GLArea::GLArea (QWidget * parent)
:QGLWidget (parent) :QGLWidget (parent)
@ -139,24 +143,6 @@ void GLArea::paintGL ()
track.DrawPostApply(); track.DrawPostApply();
} }
vcg::Trackball::Button GLArea::QT2VCG (Qt::MouseButton qtbt, Qt::KeyboardModifiers modifiers)
{
int vcgbt = vcg::Trackball::BUTTON_NONE;
if (qtbt & Qt::LeftButton)
vcgbt |= vcg::Trackball::BUTTON_LEFT;
if (qtbt & Qt::RightButton)
vcgbt |= vcg::Trackball::BUTTON_RIGHT;
if (qtbt & Qt::MidButton)
vcgbt |= vcg::Trackball::BUTTON_MIDDLE;
if (modifiers & Qt::ShiftModifier)
vcgbt |= vcg::Trackball::KEY_SHIFT;
if (modifiers & Qt::ControlModifier)
vcgbt |= vcg::Trackball::KEY_CTRL;
if (modifiers & Qt::AltModifier)
vcgbt |= vcg::Trackball::KEY_ALT;
return vcg::Trackball::Button (vcgbt);
}
void GLArea::keyReleaseEvent (QKeyEvent * e) void GLArea::keyReleaseEvent (QKeyEvent * e)
{ {
e->ignore (); e->ignore ();
@ -203,19 +189,6 @@ void GLArea::mouseReleaseEvent (QMouseEvent * e)
updateGL (); updateGL ();
} }
vcg::Trackball::Button GLArea::QTWheel2VCG (Qt::KeyboardModifiers modifiers)
{
int vcgbt = vcg::Trackball::WHEEL;
if (modifiers & Qt::ShiftModifier)
vcgbt |= vcg::Trackball::KEY_SHIFT;
if (modifiers & Qt::ControlModifier)
vcgbt |= vcg::Trackball::KEY_CTRL;
if (modifiers & Qt::AltModifier)
vcgbt |= vcg::Trackball::KEY_ALT;
return vcg::Trackball::Button (vcgbt);
}
void GLArea::wheelEvent (QWheelEvent * e) void GLArea::wheelEvent (QWheelEvent * e)
{ {
const int WHEEL_STEP = 120; const int WHEEL_STEP = 120;

View File

@ -24,10 +24,12 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.1 2007/10/18 08:52:06 benedetti
Initial release.
****************************************************************************/ ****************************************************************************/
#ifndef GLAREA_H_ #ifndef GLAREA_H_
#define GLAREA_H_ #define GLAREA_H_
@ -96,9 +98,6 @@ private:
DrawMode drawmode; DrawMode drawmode;
/// mesh data structure initializer /// mesh data structure initializer
void initMesh(QString message); void initMesh(QString message);
/// translation between QT and VCG keyboard and mouse modifiers
vcg::Trackball::Button QT2VCG (Qt::MouseButton qtbt, Qt::KeyboardModifiers modifiers);
vcg::Trackball::Button QTWheel2VCG (Qt::KeyboardModifiers modifiers);
}; };
#endif /*GLAREA_H_ */ #endif /*GLAREA_H_ */