MCPcopy Create free account
hub / github.com/KDE/kdevelop / drawCheckBox

Method drawCheckBox

plugins/clangtidy/config/checklistitemproxystyle.cpp:33–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void CheckListItemProxyStyle::drawCheckBox(QPainter* painter, const QStyleOptionViewItem* option) const
34{
35 QString iconName;
36 const auto checkState = option->checkState;
37 if (checkState == Qt::PartiallyChecked) {
38 const int effectiveEnabledState = option->index.data(CheckListModel::EffectiveEnabledStateRole).toInt();
39 if (effectiveEnabledState != CheckGroup::Enabled) {
40 return;
41 }
42 iconName = QStringLiteral("dialog-ok");
43 } else {
44 iconName = (checkState == Qt::Unchecked) ? QStringLiteral("emblem-remove") : QStringLiteral("emblem-added");
45 }
46
47 const auto icon = QIcon::fromTheme(iconName);
48
49 const QIcon::Mode iconMode = (option->state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled;
50
51 icon.paint(painter, option->rect, option->decorationAlignment, iconMode, QIcon::On);
52}
53
54}
55

Callers

nothing calls this directly

Calls 3

toIntMethod · 0.80
dataMethod · 0.45
paintMethod · 0.45

Tested by

no test coverage detected