MCPcopy Create free account
hub / github.com/baldurk/renderdoc / drawComplexControl

Method drawComplexControl

qrenderdoc/Styles/RDStyle/RDStyle.cpp:928–1348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

926}
927
928void RDStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *opt,
929 QPainter *p, const QWidget *widget) const
930{
931 // let the tweaked native style render autoraise tool buttons
932 if(control == QStyle::CC_ToolButton && (opt->state & State_AutoRaise) == 0)
933 {
934 drawRoundedRectBorder(opt, p, widget, QPalette::Button, true);
935
936 const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(opt);
937
938 QStyleOptionToolButton labelTextIcon = *toolbutton;
939 labelTextIcon.rect = subControlRect(control, opt, SC_ToolButton, widget);
940
941 // draw the label text/icon
942 proxy()->drawControl(CE_ToolButtonLabel, &labelTextIcon, p, widget);
943
944 // draw the menu arrow, if there is one
945 if(shouldDrawToolButtonMenuArrow(toolbutton))
946 {
947 QStyleOptionToolButton menu = *toolbutton;
948 menu.rect = subControlRect(control, opt, SC_ToolButtonMenu, widget);
949 proxy()->drawPrimitive(PE_IndicatorArrowDown, &menu, p, widget);
950 }
951
952 return;
953 }
954 else if(control == CC_GroupBox)
955 {
956 // when drawing the border don't apply any states intended for the checkbox
957 QStyleOptionComplex frame = *opt;
958 frame.state &=
959 ~(QStyle::State_Sunken | QStyle::State_MouseOver | QStyle::State_On | QStyle::State_Off);
960 drawRoundedRectBorder(&frame, p, widget, QPalette::Window, false);
961
962 const QStyleOptionGroupBox *group = qstyleoption_cast<const QStyleOptionGroupBox *>(opt);
963
964 QRect labelRect = proxy()->subControlRect(CC_GroupBox, opt, QStyle::SC_GroupBoxLabel, widget);
965
966 labelRect.adjust(Constants::GroupHMargin, Constants::GroupVMargin, Constants::GroupHMargin,
967 Constants::GroupVMargin);
968
969 QColor textColor = group->textColor;
970 QPalette::ColorRole penRole = QPalette::WindowText;
971
972 if(textColor.isValid())
973 {
974 p->setPen(textColor);
975 penRole = QPalette::NoRole;
976 }
977
978 proxy()->drawItemText(p, labelRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextHideMnemonic,
979 group->palette, group->state & State_Enabled, group->text, penRole);
980
981 labelRect.setRight(subControlRect(CC_GroupBox, opt, QStyle::SC_GroupBoxFrame, widget).right());
982 labelRect.adjust(-Constants::GroupHMargin / 2, 0, -Constants::GroupHMargin, 0);
983
984 p->setPen(QPen(opt->palette.brush(m_Scheme == Light ? QPalette::Mid : QPalette::Midlight), 1.0));
985 p->drawLine(labelRect.bottomLeft(), labelRect.bottomRight());

Callers 3

paintEventMethod · 0.45
paintEventMethod · 0.45
paintMethod · 0.45

Calls 15

QLineClass · 0.85
drawItemTextMethod · 0.80
setRightMethod · 0.80
bottomLeftMethod · 0.80
bottomRightMethod · 0.80
fillRectMethod · 0.80
bottomMethod · 0.80
unitedMethod · 0.80
addRoundedRectMethod · 0.80
topRightMethod · 0.80
setClipRectMethod · 0.80
QPenFunction · 0.50

Tested by

no test coverage detected