PIVX Core  5.6.99
P2P Digital Currency
focuseddialog.cpp
Go to the documentation of this file.
1 // Copyright (c) 2020 The PIVX Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include "focuseddialog.h"
6 
7 #include <QKeyEvent>
8 
9 FocusedDialog::FocusedDialog(QWidget *parent) :
10  QDialog(parent)
11 {}
12 
13 void FocusedDialog::showEvent(QShowEvent *event)
14 {
15  setFocus();
16 }
17 
18 void FocusedDialog::keyPressEvent(QKeyEvent *e)
19 {
20  if (e->type() == QEvent::KeyPress) {
21  QKeyEvent* ke = static_cast<QKeyEvent*>(e);
22  // Detect Enter key press
23  if (ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return) accept();
24  // Detect Esc key press
25  if (ke->key() == Qt::Key_Escape) reject();
26  }
27 }
28 
30 {}
void keyPressEvent(QKeyEvent *e)
void showEvent(QShowEvent *event)
FocusedDialog(QWidget *parent=nullptr)