MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / setData

Method setData

pcsx2-qt/Debugger/Breakpoints/BreakpointModel.cpp:341–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341bool BreakpointModel::setData(const QModelIndex& index, const QVariant& value, int role)
342{
343 const size_t row = static_cast<size_t>(index.row());
344 if (!index.isValid() || row >= m_breakpoints.size())
345 return false;
346
347 const BreakpointMemcheck& bp_mc = m_breakpoints[row];
348
349 if (role == Qt::CheckStateRole && index.column() == BreakpointColumns::ENABLED)
350 {
351 if (const auto* bp = std::get_if<BreakPoint>(&bp_mc))
352 {
353 Host::RunOnCPUThread([cpu = this->m_cpu.getCpuType(), bp = *bp, enabled = value.toBool()] {
354 CBreakPoints::ChangeBreakPoint(cpu, bp.addr, enabled);
355 });
356 }
357 else if (const auto* mc = std::get_if<MemCheck>(&bp_mc))
358 {
359 Host::RunOnCPUThread([cpu = this->m_cpu.getCpuType(), mc = *mc] {
360 CBreakPoints::ChangeMemCheck(cpu, mc.start, mc.end, mc.memCond,
361 MemCheckResult(mc.result ^ MEMCHECK_BREAK));
362 });
363 }
364 emit dataChanged(index, index);
365 return true;
366 }
367 else if (role == Qt::EditRole && index.column() == BreakpointColumns::CONDITION)
368 {
369 if (auto* bp = std::get_if<BreakPoint>(&bp_mc))
370 {
371 const QString condValue = value.toString();
372
373 if (condValue.isEmpty())
374 {
375 if (bp->hasCond)
376 {
377 Host::RunOnCPUThread([cpu = m_cpu.getCpuType(), bp] {
378 CBreakPoints::ChangeBreakPointRemoveCond(cpu, bp->addr);
379 });
380 }
381 }
382 else
383 {
384 PostfixExpression expr;
385
386 std::string error;
387 if (!m_cpu.initExpression(condValue.toLocal8Bit().constData(), expr, error))
388 {
389 AsyncDialogs::warning(g_debugger_window, "Condition Error", QString::fromStdString(error));
390 return false;
391 }
392
393 BreakPointCond cond;
394 cond.debug = &m_cpu;
395 cond.expression = expr;
396 cond.expressionString = condValue.toStdString();
397
398 Host::RunOnCPUThread([cpu = m_cpu.getCpuType(), bp, cond] {

Callers

nothing calls this directly

Calls 7

MemCheckResultEnum · 0.85
isValidMethod · 0.80
getCpuTypeMethod · 0.80
initExpressionMethod · 0.80
sizeMethod · 0.45
toStringMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected