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

Blend pixel history widget background color with selection color #3018

Merged
merged 1 commit into from
Aug 10, 2023
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
22 changes: 19 additions & 3 deletions qrenderdoc/Styles/RDStyle/RDStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1551,9 +1551,25 @@ void RDStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *opt, Q
group = QPalette::Inactive;

if(viewitem->state & QStyle::State_Selected)
p->fillRect(viewitem->rect, viewitem->palette.brush(group, QPalette::Highlight));
else if(viewitem->backgroundBrush.style() != Qt::NoBrush)
p->fillRect(viewitem->rect, viewitem->backgroundBrush);
{
if(viewitem->backgroundBrush.style() != Qt::NoBrush)
{
p->fillRect(viewitem->rect, viewitem->backgroundBrush);
// If we have a custom color, use the selection color at half opacity over the custom color
QColor col = viewitem->palette.color(group, QPalette::Highlight);
col.setAlphaF(0.5f);
p->fillRect(viewitem->rect, QBrush(col));
}
else
{
p->fillRect(viewitem->rect, viewitem->palette.brush(group, QPalette::Highlight));
}
}
else
{
if(viewitem->backgroundBrush.style() != Qt::NoBrush)
p->fillRect(viewitem->rect, viewitem->backgroundBrush);
}

return;
}
Expand Down
17 changes: 5 additions & 12 deletions qrenderdoc/Widgets/Extended/RDTreeView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,18 +771,11 @@ void RDTreeView::drawBranches(QPainter *painter, const QRect &rect, const QModel
idx = idx.parent();
}

opt.rect = rect;
opt.rect.setWidth(depth * indentation());
opt.rect = allLinesRect;
opt.showDecorationSelected = true;
opt.backgroundBrush = index.data(Qt::BackgroundRole).value<QBrush>();
style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, this);

QBrush back = index.data(Qt::BackgroundRole).value<QBrush>();

if(!selectionModel()->isSelected(index) && back.style() != Qt::NoBrush)
{
painter->fillRect(allLinesRect, back);
}

if(m_VisibleBranches)
{
QTreeView::drawBranches(painter, rect, index);
Expand Down Expand Up @@ -821,12 +814,12 @@ void RDTreeView::drawBranches(QPainter *painter, const QRect &rect, const QModel
{
parent = parents.pop();

back = parent.data(RDTreeView::TreeLineColorRole).value<QBrush>();
QBrush line = parent.data(RDTreeView::TreeLineColorRole).value<QBrush>();

if(back.style() != Qt::NoBrush)
if(line.style() != Qt::NoBrush)
{
// draw a centred pen vertically down the middle of branchRect
painter->setPen(QPen(QBrush(back), m_treeColorLineWidth));
painter->setPen(QPen(line, m_treeColorLineWidth));

QPoint topCentre = QRect(branchRect).center();
QPoint bottomCentre = topCentre;
Expand Down