1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Android: Catch Back key and exit

This commit is contained in:
tux3 2015-02-22 19:08:18 +01:00
parent 245c09b25e
commit 5ab703eb27
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 16 additions and 0 deletions

View File

@ -12,6 +12,8 @@
#include "src/nexus.h"
#include "src/widget/friendwidget.h"
#include "src/widget/groupwidget.h"
#include <QDebug>
#include <QKeyEvent>
#include <QLabel>
#include <QMenu>
@ -167,3 +169,15 @@ void AndroidGUI::onStatusSet(Status status)
Style::repolish(ui->statusButton);
}
void AndroidGUI::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Back)
{
qDebug() << "AndroidGUI: Back key pressed, quitting";
qApp->exit(0);
}
else if (event->key() == Qt::Key_Menu)
{
qDebug() << "AndroidGUI: Menu key pressed";
}
}

View File

@ -6,6 +6,7 @@
class MaskablePixmapWidget;
class FriendListWidget;
class QKeyEvent;
namespace Ui {
class Android;
@ -36,6 +37,7 @@ signals:
private:
void reloadTheme();
virtual void keyPressEvent(QKeyEvent* event) final;
private slots:
void onUsernameChanged(const QString& newUsername, const QString& oldUsername);