behnia_k
31st October 2007, 14:04
Hi all,
I dont use any QWidget in my project (use QTimer and QSocket)
How to handel keyboard.
i use Qt 2.3.0
class clMyObject : public QObject
{
public:
clMyObject(QObject *parent=0, const char *name) : QObject(parent, name) {};
//
bool event(QEvent * e)
{
if (e->type == QEvent::KeyPress)
{
qDebug("Key press");
}
else
{
qDebug("no Key press event %d", e->type());
}
//
return QObject::event();
};
};
int main(int argc, char **argv)
{
QAplication a(argc, argv, false);
//
clMyObject MyObject(a);
//
return a.exec();
}
I dont use any QWidget in my project (use QTimer and QSocket)
How to handel keyboard.
i use Qt 2.3.0
class clMyObject : public QObject
{
public:
clMyObject(QObject *parent=0, const char *name) : QObject(parent, name) {};
//
bool event(QEvent * e)
{
if (e->type == QEvent::KeyPress)
{
qDebug("Key press");
}
else
{
qDebug("no Key press event %d", e->type());
}
//
return QObject::event();
};
};
int main(int argc, char **argv)
{
QAplication a(argc, argv, false);
//
clMyObject MyObject(a);
//
return a.exec();
}