[Qt-interest] Fwd: key event not responding
ami guru
dosto.walla at gmail.com
Sun Mar 8 07:24:20 CET 2009
Hello forum,
Solve that by setting Qt::StrongFocus in the focus policy.
How to set the glwidget to be the default focus
Any other better way to do that?
---------- Forwarded message ----------
From: ami guru <dosto.walla at gmail.com>
Date: Sun, Mar 8, 2009 at 4:35 AM
Subject: key event not responding
To: qt-interest at trolltech.com
Hello forum,
I have a created a globject (subclass of QGLWidget ) inside the mainwindow
and i want to implement a keyboeard event to move light sources.
i have reimplemented the keyPressEvent() but it is not responding upon
keypress.
That is the following code for that:
**********************************************
void GLWidget::keyPressEvent(QKeyEvent *event)
{
qDebug() << "event caught" << endl;
switch(event->key())
{
case Qt::Key_Left:
yKeyRot -= 5.0f;
break;
case Qt::Key_Right:
yKeyRot += 5.0f;
break;
case Qt::Key_Up:
xKeyRot -= 5.0f;
break;
case Qt::Key_Down:
xKeyRot += 5.0f;
break;
case Qt::Key_Space:
defualt:
break;
}
updateGL();
}
*************************************************
Any hint ?
Regards
Sajjad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090308/f261359f/attachment.html
More information about the Qt-interest-old
mailing list