diff --git a/gui/qt/debugger.cpp b/gui/qt/debugger.cpp index 0d82d9172..79b87ef58 100644 --- a/gui/qt/debugger.cpp +++ b/gui/qt/debugger.cpp @@ -2009,6 +2009,15 @@ void MainWindow::gotoDisasmAddr(uint32_t address) { void MainWindow::gotoMemAddr(uint32_t address) { if (m_memWidget != Q_NULLPTR) { memGoto(m_memWidget, address); + } else { + for (HexWidget *edit : { ui->flashEdit, ui->ramEdit }) { + uint32_t offset = address - edit->getBase(); + if (offset < edit->getSize()) { + edit->setFocus(); + edit->setOffset(offset); + break; + } + } } } @@ -2710,6 +2719,7 @@ void MainWindow::addVisualizerDock(const QString &magic, const QString &config) }); dw->setState(m_uiEditMode); + dw->setAttribute(Qt::WA_DeleteOnClose); addDockWidget(Qt::RightDockWidgetArea, dw); dw->setObjectName(magic); dw->setWidget(widget); @@ -2730,6 +2740,7 @@ void MainWindow::addMemDock(const QString &magic, int bytes, bool ascii) { dw = new DockWidget(TXT_MEM_DOCK, this); dw->setObjectName(magic); dw->setState(m_uiEditMode); + dw->setAttribute(Qt::WA_DeleteOnClose); if (m_setup) { dw->setFloating(true); diff --git a/gui/qt/mainwindow.cpp b/gui/qt/mainwindow.cpp index 7765c7d73..e0905b6f2 100644 --- a/gui/qt/mainwindow.cpp +++ b/gui/qt/mainwindow.cpp @@ -425,6 +425,8 @@ MainWindow::MainWindow(CEmuOpts &cliOpts, QWidget *p) : QMainWindow(p), ui(new U connect(ui->buttonRamSync, &QToolButton::clicked, this, &MainWindow::ramSyncPressed); connect(ui->flashEdit, &HexWidget::customContextMenuRequested, this, &MainWindow::contextMem); connect(ui->ramEdit, &HexWidget::customContextMenuRequested, this, &MainWindow::contextMem); + connect(ui->flashEdit, &HexWidget::focused, [this] { m_memWidget = Q_NULLPTR; }); + connect(ui->ramEdit, &HexWidget::focused, [this] { m_memWidget = Q_NULLPTR; }); // keymap connect(ui->radioNaturalKeys, &QRadioButton::clicked, this, &MainWindow::keymapChanged); diff --git a/gui/qt/mainwindow.h b/gui/qt/mainwindow.h index 857c3183e..fe8536c87 100644 --- a/gui/qt/mainwindow.h +++ b/gui/qt/mainwindow.h @@ -26,6 +26,7 @@ #include /* Different module in Qt5 vs Qt6 */ #include #include +#include #include #include #include @@ -699,7 +700,7 @@ class MainWindow : public QMainWindow { QStringList m_docksVisualizerConfig; QList m_dockPtrs; QSettings *m_config = Q_NULLPTR; - HexWidget *m_memWidget = Q_NULLPTR; + QPointer m_memWidget = Q_NULLPTR; QString m_pathRom; QString m_pathRam;