| 158 | } |
| 159 | |
| 160 | void 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 | |
| 187 | void CCheckBoxHeader::DrawText(QPainter* painter, const QRect& rect, |
| 188 | const QString& text, Qt::Alignment alignment) const |
nothing calls this directly
no outgoing calls
no test coverage detected