Key press event handling in certain Insight windows
This commit is contained in:
@@ -145,6 +145,22 @@ namespace Widgets
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryRegionManagerWindow::keyPressEvent(QKeyEvent* event) {
|
||||
const auto key = event->key();
|
||||
|
||||
if (key == Qt::Key_Enter || key == Qt::Key_Return) {
|
||||
this->applyButton->click();
|
||||
return;
|
||||
}
|
||||
|
||||
if (key == Qt::Key_Escape) {
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
|
||||
QWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void MemoryRegionManagerWindow::clearRegions() {
|
||||
this->selectedRegion = nullptr;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <QShowEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QScrollArea>
|
||||
#include <QVBoxLayout>
|
||||
#include <QStackedLayout>
|
||||
@@ -42,6 +43,7 @@ namespace Widgets
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
private:
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor;
|
||||
|
||||
@@ -102,6 +102,22 @@ namespace Widgets
|
||||
QWidget::showEvent(event);
|
||||
}
|
||||
|
||||
void CreateSnapshotWindow::keyPressEvent(QKeyEvent* event) {
|
||||
const auto key = event->key();
|
||||
|
||||
if (key == Qt::Key_Enter || key == Qt::Key_Return) {
|
||||
this->captureButton->click();
|
||||
return;
|
||||
}
|
||||
|
||||
if (key == Qt::Key_Escape) {
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
|
||||
QWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
bool CreateSnapshotWindow::captureEnabled() {
|
||||
if (this->targetState != Targets::TargetState::STOPPED) {
|
||||
return false;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QShowEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QCheckBox>
|
||||
#include <optional>
|
||||
@@ -38,6 +39,7 @@ namespace Widgets
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
private:
|
||||
QWidget* container = nullptr;
|
||||
|
||||
@@ -221,6 +221,31 @@ namespace Widgets
|
||||
);
|
||||
}
|
||||
|
||||
void TargetRegisterInspectorWindow::keyPressEvent(QKeyEvent* event) {
|
||||
const auto key = event->key();
|
||||
|
||||
if ((event->modifiers() & Qt::ControlModifier) != 0 && key == Qt::Key_R) {
|
||||
this->refreshValueButton->click();
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
(event->modifiers() & Qt::ControlModifier) != 0
|
||||
&& (key == Qt::Key_Enter || key == Qt::Key_Return)
|
||||
&& this->registerValueTextInput->hasFocus()
|
||||
) {
|
||||
this->applyButton->click();
|
||||
return;
|
||||
}
|
||||
|
||||
if (key == Qt::Key_Escape) {
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
|
||||
QWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
bool TargetRegisterInspectorWindow::registerSupported(const Targets::TargetRegisterDescriptor& descriptor) {
|
||||
return (descriptor.size > 0 && descriptor.size <= 8);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
#include <set>
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
#include <QEvent>
|
||||
#include <QResizeEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QScrollArea>
|
||||
#include <optional>
|
||||
|
||||
@@ -36,6 +37,7 @@ namespace Widgets
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
private:
|
||||
Targets::TargetRegisterDescriptor registerDescriptor;
|
||||
|
||||
Reference in New Issue
Block a user