Skip to content

Commit

Permalink
Color unused cells.
Browse files Browse the repository at this point in the history
(bug?) Does not update on dark/light style change, as no signals are sent.
  • Loading branch information
TryTwo committed May 23, 2024
1 parent e326228 commit dbacb60
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ BreakpointWidget::BreakpointWidget(QWidget* parent)
setHidden(!enabled || !Settings::Instance().IsBreakpointsVisible());
});

connect(&Settings::Instance(), &Settings::ThemeChanged, this, &BreakpointWidget::UpdateIcons);
connect(&Settings::Instance(), &Settings::ThemeChanged, this, [this]() {
UpdateIcons();
Update();
});

UpdateIcons();
}

Expand Down Expand Up @@ -269,7 +273,9 @@ void BreakpointWidget::Update()
// Get row height for icons
m_table->setRowCount(1);
const int height = m_table->rowHeight(0);
m_table->setRowCount(0);

int i = 0;
m_table->setRowCount(i);

// Create icon based on row height, downscaled for whitespace padding.
const int downscale = static_cast<int>(0.8 * height);
Expand All @@ -286,14 +292,19 @@ void BreakpointWidget::Update()
empty_item.setFlags(Qt::NoItemFlags);
QTableWidgetItem icon_item = QTableWidgetItem();
icon_item.setData(Qt::DecorationRole, enabled_icon);
QTableWidgetItem disabled_item = QTableWidgetItem();
disabled_item.setFlags(Qt::NoItemFlags);

if (Settings::Instance().IsThemeDark())
disabled_item.setBackground(QColor(75, 75, 75));
else
disabled_item.setBackground(QColor(225, 225, 225));

auto& power_pc = m_system.GetPowerPC();
auto& breakpoints = power_pc.GetBreakPoints();
auto& memchecks = power_pc.GetMemChecks();
auto& ppc_symbol_db = power_pc.GetSymbolDB();

int i = 0;

// Breakpoints
for (const auto& bp : breakpoints.GetBreakPoints())
{
Expand Down Expand Up @@ -321,11 +332,12 @@ void BreakpointWidget::Update()
address_item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable);

m_table->setItem(i, ADDRESS_COLUMN, address_item);
m_table->setItem(i, END_ADDRESS_COLUMN, empty_item.clone());
m_table->setItem(i, BREAK_COLUMN, bp.break_on_hit ? icon_item.clone() : empty_item.clone());
m_table->setItem(i, LOG_COLUMN, bp.log_on_hit ? icon_item.clone() : 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, END_ADDRESS_COLUMN, disabled_item.clone());
m_table->setItem(i, READ_COLUMN, disabled_item.clone());
m_table->setItem(i, WRITE_COLUMN, disabled_item.clone());

m_table->setItem(
i, CONDITION_COLUMN,
Expand Down

0 comments on commit dbacb60

Please sign in to comment.