QTest::keyPress is not returning nativeScanCode
- by vels
Hi,
I am simulating F1 key using QTest::keyPress() method to test keypress event, on simulation of F1 key when i check for nativeScanCode, it returns 0 value. can any one help?
//Code snippet
//To simulate F1 key press
QTest::keyPress(&kboard, Qt::Key_F1);
//To check keypress Event
void keyboard::keyPressEvent(QKeyEvent* ke) {
if ( ke->type() == QEvent::KeyPress ) {
QKeyEvent* key_event = static_cast<QKeyEvent *>(ke);
//To check F1 key simulation
if (key_event->key() == Qt::Key_F1) {
int nativeCode = key_event->nativeScanCode();
qDebug()<< nativeCode <<endl;
}
}
}
Thanks,
vels