diff --git a/qrenderdoc/Styles/RDTweakedNativeStyle/RDTweakedNativeStyle.cpp b/qrenderdoc/Styles/RDTweakedNativeStyle/RDTweakedNativeStyle.cpp index 9b27670fda..9886e82b6a 100644 --- a/qrenderdoc/Styles/RDTweakedNativeStyle/RDTweakedNativeStyle.cpp +++ b/qrenderdoc/Styles/RDTweakedNativeStyle/RDTweakedNativeStyle.cpp @@ -257,16 +257,12 @@ void RDTweakedNativeStyle::drawPrimitive(PrimitiveElement element, const QStyleO QColor col = opt->palette.color(QPalette::Text); - if(opt->state & State_MouseOver) - { - QColor highlightCol = opt->palette.color(QPalette::Highlight); - - col.setRedF(col.redF() * 0.6 + highlightCol.redF() * 0.4); - col.setGreenF(col.greenF() * 0.6 + highlightCol.greenF() * 0.4); - col.setBlueF(col.blueF() * 0.6 + highlightCol.blueF() * 0.4); - } - - p->setPen(QPen(col, 2.0)); + // turbo hack to pass desired colour through QTreeView::drawBranches when it can't customise + // the colour and doesn't set the model index to let us look up this data ourselves :( + if(oldPen.widthF() == 1234.5f) + p->setPen(QPen(oldPen.color(), 2.0)); + else + p->setPen(QPen(col, 2.0)); QPainterPath path; diff --git a/qrenderdoc/Widgets/Extended/RDTreeView.cpp b/qrenderdoc/Widgets/Extended/RDTreeView.cpp index 0c7a9d10fa..e76534bd8b 100644 --- a/qrenderdoc/Widgets/Extended/RDTreeView.cpp +++ b/qrenderdoc/Widgets/Extended/RDTreeView.cpp @@ -774,10 +774,19 @@ void RDTreeView::drawBranches(QPainter *painter, const QRect &rect, const QModel opt.rect = allLinesRect; opt.showDecorationSelected = true; opt.backgroundBrush = index.data(Qt::BackgroundRole).value(); + QColor foreCol = index.data(Qt::ForegroundRole).value().color(); + opt.palette.setColor(QPalette::Foreground, foreCol); + opt.palette.setColor(QPalette::Text, foreCol); + style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, this); + QPen oldPen = painter->pen(); + if(m_VisibleBranches) { + // set the desired colour for RDTweakedNativeStyle via a huge hack - see + // RDTweakedNativeStyle::drawPrimitive for QStyle::PE_IndicatorBranch + painter->setPen(QPen(foreCol, 1234.5)); QTreeView::drawBranches(painter, rect, index); } else @@ -804,12 +813,13 @@ void RDTreeView::drawBranches(QPainter *painter, const QRect &rect, const QModel if(isExpanded(index)) branchopt.state |= QStyle::State_Open; + branchopt.palette = opt.palette; + style()->drawPrimitive(QStyle::PE_IndicatorBranch, &branchopt, painter, this); } // we now iterate from the top-most parent down, moving in from the left // we draw this after calling into drawBranches() so we paint on top of the built-in lines - QPen oldPen = painter->pen(); while(!parents.isEmpty()) { parent = parents.pop();