mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-31 16:20:26 -05:00
override the keyPressEvent function, enabling the statistics window to close when the Escape key is pressed
This commit is contained in:
parent
a17699e166
commit
0bca0d3b27
2 changed files with 12 additions and 1 deletions
|
|
@ -23,6 +23,7 @@
|
|||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
#include <QActionGroup>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
|
@ -228,3 +229,12 @@ void StatisticsWindow::setNewPage(int page)
|
|||
ui->stackPages->setCurrentIndex(page);
|
||||
}
|
||||
}
|
||||
|
||||
void StatisticsWindow::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Escape) {
|
||||
close(); // Close window is escape is pressed
|
||||
} else {
|
||||
QMainWindow::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@ public slots:
|
|||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
void closeEvent (QCloseEvent * event);
|
||||
void closeEvent (QCloseEvent * event);
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
private:
|
||||
void initStackedPage();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue