From e7fd2e24db21bba2dc7ed7e1b3af5c706e69b915 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 25 Jul 2017 11:55:03 +0100 Subject: [PATCH] Draw checkbox/radio labels ourselves --- qrenderdoc/Styles/RDStyle/RDStyle.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/qrenderdoc/Styles/RDStyle/RDStyle.cpp b/qrenderdoc/Styles/RDStyle/RDStyle.cpp index 6207b59da..085ca6995 100644 --- a/qrenderdoc/Styles/RDStyle/RDStyle.cpp +++ b/qrenderdoc/Styles/RDStyle/RDStyle.cpp @@ -541,6 +541,32 @@ void RDStyle::drawControl(ControlElement control, const QStyleOption *opt, QPain return; } + else if(control == CE_CheckBoxLabel || control == QStyle::CE_RadioButtonLabel) + { + const QStyleOptionButton *checkbox = qstyleoption_cast(opt); + if(checkbox) + { + QRect rect = checkbox->rect; + + if(!checkbox->icon.isNull()) + { + drawItemPixmap(p, rect, Qt::AlignLeft | Qt::AlignVCenter, + checkbox->icon.pixmap( + checkbox->iconSize.width(), checkbox->iconSize.height(), + checkbox->state & State_Enabled ? QIcon::Normal : QIcon::Disabled)); + + rect.setLeft(rect.left() + checkbox->iconSize.width() + Constants::CheckMargin); + } + + if(!checkbox->text.isEmpty()) + { + drawItemText(p, rect, Qt::AlignLeft | Qt::AlignVCenter, checkbox->palette, + checkbox->state & State_Enabled, checkbox->text, QPalette::WindowText); + } + } + + return; + } RDTweakedNativeStyle::drawControl(control, opt, p, widget); }