Qt android handling Backbutton pressed
Unsolved
Mobile and Embedded
-
How to minimize application on backkey pressed in android
-
void Widget::keyPressEvent(QKeyEvent *event)
{
switch (event->key())
{
case Qt::Key_Backspace:
this->showMinimized();
break;
default:
QWidget::keyPressEvent(event);
}
} -
@Vinod-Kuntoji
thanks for reply .. actually i am not using widgets .. i need in qml .. -
Item {
focus: true
Keys.onPressed: {
console.log(event.key)
if (event.key === Qt.Key_Back) {
mainWindow.showMinimized();
event.accepted = true;
}
}
}
It wont work, but it will print key value.
something like 16777219.
I used this value to compare with event key.
It worked
if (event.key === 16777219) {
mainWindow.showMinimized();
}