BreakpointWidget: Give conditionals a popup text entry on click.
This commit is contained in:
parent
e52b814eb2
commit
1396e927c7
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
#include <QInputDialog>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
@ -219,10 +220,26 @@ void BreakpointWidget::OnClicked(QTableWidgetItem* item)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<QString> string = std::nullopt;
|
||||||
|
|
||||||
|
if (item->column() == CONDITION_COLUMN)
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
QString new_text = QInputDialog::getMultiLineText(
|
||||||
|
this, tr("Edit Conditional"), tr("Edit conditional expression"), item->text(), &ok);
|
||||||
|
|
||||||
|
if (!ok || item->text() == new_text)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// If new_text is empty, leaving string as nullopt will clear the conditional.
|
||||||
|
if (!new_text.isEmpty())
|
||||||
|
string = new_text;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_table->item(item->row(), 0)->data(IS_MEMCHECK_ROLE).toBool())
|
if (m_table->item(item->row(), 0)->data(IS_MEMCHECK_ROLE).toBool())
|
||||||
EditMBP(address, item->column());
|
EditMBP(address, item->column(), string);
|
||||||
else
|
else
|
||||||
EditBreakpoint(address, item->column());
|
EditBreakpoint(address, item->column(), string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakpointWidget::UpdateButtonsEnabled()
|
void BreakpointWidget::UpdateButtonsEnabled()
|
||||||
|
@ -310,12 +327,9 @@ void BreakpointWidget::Update()
|
||||||
m_table->setItem(i, READ_COLUMN, empty_item.clone());
|
m_table->setItem(i, READ_COLUMN, empty_item.clone());
|
||||||
m_table->setItem(i, WRITE_COLUMN, empty_item.clone());
|
m_table->setItem(i, WRITE_COLUMN, empty_item.clone());
|
||||||
|
|
||||||
QString condition;
|
m_table->setItem(
|
||||||
|
i, CONDITION_COLUMN,
|
||||||
if (bp.condition)
|
create_item(bp.condition ? QString::fromStdString(bp.condition->GetText()) : QString()));
|
||||||
condition = QString::fromStdString(bp.condition->GetText());
|
|
||||||
|
|
||||||
m_table->setItem(i, CONDITION_COLUMN, create_item(condition));
|
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -362,12 +376,9 @@ void BreakpointWidget::Update()
|
||||||
m_table->setItem(i, WRITE_COLUMN,
|
m_table->setItem(i, WRITE_COLUMN,
|
||||||
mbp.is_break_on_write ? icon_item.clone() : empty_item.clone());
|
mbp.is_break_on_write ? icon_item.clone() : empty_item.clone());
|
||||||
|
|
||||||
QString condition;
|
m_table->setItem(
|
||||||
|
i, CONDITION_COLUMN,
|
||||||
if (mbp.condition)
|
create_item(mbp.condition ? QString::fromStdString(mbp.condition->GetText()) : QString()));
|
||||||
condition = QString::fromStdString(mbp.condition->GetText());
|
|
||||||
|
|
||||||
m_table->setItem(i, CONDITION_COLUMN, create_item(condition));
|
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue