diff --git a/Source/GUI/MemWatcher/Dialogs/DlgAddWatchEntry.cpp b/Source/GUI/MemWatcher/Dialogs/DlgAddWatchEntry.cpp index 337509d..7d217f3 100644 --- a/Source/GUI/MemWatcher/Dialogs/DlgAddWatchEntry.cpp +++ b/Source/GUI/MemWatcher/Dialogs/DlgAddWatchEntry.cpp @@ -193,6 +193,7 @@ void DlgAddWatchEntry::fillFields(MemWatchEntry* entry) void DlgAddWatchEntry::addPointerOffset() { int level = static_cast(m_entry->getPointerLevel()); + m_entry->addOffset(0); QLabel* lblLevel = new QLabel(QString::fromStdString("Level " + std::to_string(level + 1) + ":")); QLineEdit* txbOffset = new QLineEdit(); m_offsets.append(txbOffset); @@ -207,7 +208,7 @@ void DlgAddWatchEntry::addPointerOffset() m_offsetsLayout->addWidget(lblLevel, level, 0); m_offsetsLayout->addWidget(txbOffset, level, 1); m_offsetsLayout->addWidget(lblAddressOfPath, level, 2); - m_entry->addOffset(0); + connect(txbOffset, &QLineEdit::textEdited, this, &DlgAddWatchEntry::onOffsetChanged); if (m_entry->getPointerLevel() > 1) m_btnRemoveOffset->setEnabled(true); diff --git a/Source/GUI/MemWatcher/MemWatchModel.cpp b/Source/GUI/MemWatcher/MemWatchModel.cpp index bbe5004..0a2c561 100644 --- a/Source/GUI/MemWatcher/MemWatchModel.cpp +++ b/Source/GUI/MemWatcher/MemWatchModel.cpp @@ -119,7 +119,9 @@ void MemWatchModel::changeType(const QModelIndex& index, Common::MemType type, s MemWatchEntry* MemWatchModel::getEntryFromIndex(const QModelIndex& index) { MemWatchTreeNode* node = static_cast(index.internalPointer()); - return node->getEntry(); + if (node) + return node->getEntry(); + return nullptr; } void MemWatchModel::addNodes(const std::vector& nodes, diff --git a/Source/GUI/MemWatcher/MemWatchWidget.cpp b/Source/GUI/MemWatcher/MemWatchWidget.cpp index 25b7e30..953568d 100644 --- a/Source/GUI/MemWatcher/MemWatchWidget.cpp +++ b/Source/GUI/MemWatcher/MemWatchWidget.cpp @@ -267,6 +267,17 @@ void MemWatchWidget::onMemWatchContextMenuRequested(const QPoint& pos) contextMenu->addSeparator(); } + if (!node || node->isGroup()) + { + QAction* const addGroup{new QAction(tr("Add gro&up"), this)}; + connect(addGroup, &QAction::triggered, this, &MemWatchWidget::onAddGroup); + contextMenu->addAction(addGroup); + QAction* const addWatch{new QAction(tr("Add &watch"), this)}; + connect(addWatch, &QAction::triggered, this, &MemWatchWidget::onAddWatchEntry); + contextMenu->addAction(addWatch); + contextMenu->addSeparator(); + } + QAction* cut = new QAction(tr("Cu&t"), this); connect(cut, &QAction::triggered, this, [this] { cutSelectedWatchesToClipBoard(); }); contextMenu->addAction(cut);