Skip to content
Permalink
Browse files
Merge pull request #6867 from jackoalan/code-view-bg
Qt/CodeViewWidget: Dynamic background dimming for dark themes
  • Loading branch information
leoetlino committed May 16, 2018
2 parents 9335400 + d14f6e9 commit 4de2c50
Showing 1 changed file with 8 additions and 7 deletions.
@@ -100,6 +100,8 @@ void CodeViewWidget::Update()
if (Core::GetState() != Core::State::Paused && PowerPC::debug_interface.IsBreakpoint(pc))
Core::SetState(Core::State::Paused);

const bool dark_theme = qApp->palette().color(QPalette::Base).valueF() < 0.5;

for (int i = 0; i < rowCount(); i++)
{
u32 addr = m_address - ((rowCount() / 2) * 4) + i * 4;
@@ -123,15 +125,14 @@ void CodeViewWidget::Update()
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
item->setData(Qt::UserRole, addr);

if (color != 0xFFFFFF)
if (addr == pc && item != bp_item)
{
item->setForeground(Qt::black);
item->setBackground(QColor(color));
item->setBackground(QColor(Qt::green));
item->setForeground(QColor(Qt::black));
}
if (addr == pc && item != bp_item)
else if (color != 0xFFFFFF)
{
item->setBackground(Qt::green);
item->setForeground(Qt::black);
item->setBackground(dark_theme ? QColor(color).darker(240) : QColor(color));
}
}

@@ -151,7 +152,7 @@ void CodeViewWidget::Update()
}

if (ins == "blr")
ins_item->setForeground(Qt::darkGreen);
ins_item->setForeground(dark_theme ? QColor(0xa0FFa0) : Qt::darkGreen);

if (PowerPC::debug_interface.IsBreakpoint(addr))
{

0 comments on commit 4de2c50

Please sign in to comment.