MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / DrawCheckBox

Method DrawCheckBox

Src/CheckBoxHeader.cpp:160–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160void CCheckBoxHeader::DrawCheckBox(QPainter* painter, const QRect& rect,
161 Qt::CheckState state, bool enabled) const
162{
163 QStyleOptionButton option;
164 option.rect = rect;
165 option.state = QStyle::State_Enabled | QStyle::State_Active;
166
167 if (enabled) {
168 option.state |= QStyle::State_Enabled;
169 }
170
171 switch (state) {
172 case Qt::Checked:
173 option.state |= QStyle::State_On;
174 break;
175 case Qt::PartiallyChecked:
176 option.state |= QStyle::State_NoChange;
177 break;
178 case Qt::Unchecked:
179 option.state |= QStyle::State_Off;
180 break;
181 }
182
183 // 绘制复选框
184 style()->drawControl(QStyle::CE_CheckBox, &option, painter, this);
185}
186
187void CCheckBoxHeader::DrawText(QPainter* painter, const QRect& rect,
188 const QString& text, Qt::Alignment alignment) const

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected