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:
parent
245c09b25e
commit
5ab703eb27
|
@ -12,6 +12,8 @@
|
||||||
#include "src/nexus.h"
|
#include "src/nexus.h"
|
||||||
#include "src/widget/friendwidget.h"
|
#include "src/widget/friendwidget.h"
|
||||||
#include "src/widget/groupwidget.h"
|
#include "src/widget/groupwidget.h"
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QKeyEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
|
@ -167,3 +169,15 @@ void AndroidGUI::onStatusSet(Status status)
|
||||||
Style::repolish(ui->statusButton);
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
class MaskablePixmapWidget;
|
class MaskablePixmapWidget;
|
||||||
class FriendListWidget;
|
class FriendListWidget;
|
||||||
|
class QKeyEvent;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Android;
|
class Android;
|
||||||
|
@ -36,6 +37,7 @@ signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void reloadTheme();
|
void reloadTheme();
|
||||||
|
virtual void keyPressEvent(QKeyEvent* event) final;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onUsernameChanged(const QString& newUsername, const QString& oldUsername);
|
void onUsernameChanged(const QString& newUsername, const QString& oldUsername);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user