Hi all,
I dont use any QWidget in my project (use QTimer and QSocket)
How to handel keyboard.
i use Qt 2.3.0
{
public:
clMyObject
(QObject *parent
=0,
const char *name
) : QObject(parent, name
) {};
//
{
if (e
->type
== QEvent::KeyPress) {
qDebug("Key press");
}
else
{
qDebug("no Key press event %d", e->type());
}
//
};
};
int main(int argc, char **argv)
{
QAplication a(argc, argv, false);
//
clMyObject MyObject(a);
//
return a.exec();
}
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();
}
To copy to clipboard, switch view to plain text mode
Bookmarks