#include <QMouseEvent>
#include <QListWidget>
+#include <QTimer>
#ifdef USE_FPS_COUNTER
ChooseStylePreset( PRESET_SPHERES_AND_BICOLOR_BONDS );
setMinimumSize( 100,100 );
+
+ QTimer *timer = new QTimer( this );
+ connect( timer, SIGNAL( timeout() ), this, SLOT( rotate() ) );
+ timer->start( 50 );
}
KalziumGLWidget::~KalziumGLWidget()
}
}
+void KalziumGLWidget::rotate( )
+{
+ kDebug() << "KalziumGLWidget::rotate()" << endl;
+ //TODO at this place we need a nice way to rotate
+ //based on certain values. For example, we could use two
+ //bool variables for x and y rotation. If x is true the
+ //molecule will rotate in the x-axis, if false not. Same
+ //for y.
+ //As I have no idea what this code is doing I just copy&pasted
+ //everything from the mousewheel method...
+ glPushMatrix();
+ glLoadIdentity();
+
+ //Benoit, I took those values pretty much at random,
+ //no idea what value is for what... :)
+ glRotated( 10.0, 0.0, 1.0, 0.0 );
+ glRotated( 10.0, 1.0, 0.0, 0.0 );
+ glMultMatrixd( m_RotationMatrix );
+ glGetDoublev( GL_MODELVIEW_MATRIX, m_RotationMatrix );
+ glPopMatrix();
+ updateGL();
+}
+
void KalziumGLWidget::setupObjects()
{
int sphere_detail, cylinder_faces;
return m_atomRadiusCoeff * m_molMinBondLength;
}
+void KalziumGLWidget::slotZoomIn()
+{
+ //TODO
+ //This slot can be very easily accessed by simply calling it from
+ //the GUI. I guess we need a second pair of zoomin/out slots for
+ //a more finegrained zooming. For example, if we use the mousewheel
+ //for zooming, we might want to use the delta()-value of the mouse-
+ //wheel as a factor.
+ //But as I have no idea how zooming works in OpenGL I cannot do the
+ //coding...
+}
+
+void KalziumGLWidget::slotZoomOut()
+{
+ //TODO
+ //Comment so slotZoomIn()
+}
+
void KalziumGLWidget::slotSetMolecule( OpenBabel::OBMol* molecule )
{
if ( !molecule ) return;
virtual ~KalziumGLWidget();
/**
- * returns a pointer to the molecule being worked on
+ * @return Returns a pointer to the molecule being worked on
*/
- inline OpenBabel::OBMol* molecule () const
- { return m_molecule; }
+ OpenBabel::OBMol* molecule () const {
+ return m_molecule;
+ }
signals:
/**
void atomsSelected( QList<OpenBabel::OBAtom*> atoms );
public slots:
+ /**
+ * The autorotation timer ended so we have to move the molecule a bit more
+ * not needed I guess
+ */
+ void rotate();
+
/**
* sets the molecule which will be displayed
* @param molecule the molecule to render
*/
void slotSetMolecule( OpenBabel::OBMol* molecule );
+
+ /**
+ * zoom in by 10%
+ */
+ void slotZoomIn();
+
+ /**
+ * zoom out by 10%
+ */
+ void slotZoomOut();
+
/**
* Sets the detail-grade in a range from 0 to 2