Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark session with unsaved changes during grouping and inline label editing. #154

Merged
merged 2 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Source/GUI/MemWatcher/MemWatchModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ bool MemWatchModel::editData(const QModelIndex& index, const QVariant& value, co
{
entry->setLabel(value.toString());
emit dataChanged(index, index);
if (emitEdit)
emit dataEdited(index, value, role);
return true;
}
case WATCH_COL_VALUE:
Expand Down
20 changes: 16 additions & 4 deletions Source/GUI/MemWatcher/MemWatchWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,13 @@ void MemWatchWidget::setSelectedWatchesBase(MemWatchEntry* entry, Common::MemBas

void MemWatchWidget::groupCurrentSelection()
{
m_watchModel->groupSelection(simplifySelection());
const QModelIndexList indexes{simplifySelection()};
if (indexes.isEmpty())
return;

m_watchModel->groupSelection(indexes);

m_hasUnsavedChanges = true;
}

void MemWatchWidget::cutSelectedWatchesToClipBoard()
Expand Down Expand Up @@ -417,12 +423,18 @@ void MemWatchWidget::onWatchDoubleClicked(const QModelIndex& index)

void MemWatchWidget::onDataEdited(const QModelIndex& index, const QVariant& value, const int role)
{
MemWatchTreeNode* const node{static_cast<MemWatchTreeNode*>(index.internalPointer())};
if (node->isGroup())
if (role != Qt::EditRole)
return;

if (role == Qt::EditRole && index.column() == MemWatchModel::WATCH_COL_VALUE)
const int column{index.column()};
if (column == MemWatchModel::WATCH_COL_LABEL || column == MemWatchModel::WATCH_COL_TYPE ||
column == MemWatchModel::WATCH_COL_ADDRESS)
{
m_hasUnsavedChanges = true;
}
else if (column == MemWatchModel::WATCH_COL_VALUE)
{
MemWatchTreeNode* const node{static_cast<MemWatchTreeNode*>(index.internalPointer())};
MemWatchEntry* const entry{node->getEntry()};
const Common::MemType entryType{entry->getType()};

Expand Down
Loading