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

Method DrawText

Src/CheckBoxHeader.cpp:187–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187void CCheckBoxHeader::DrawText(QPainter* painter, const QRect& rect,
188 const QString& text, Qt::Alignment alignment) const
189{
190 if (text.isEmpty()) return;
191
192 painter->save();
193
194 // 文本省略处理
195 QFontMetrics fm = painter->fontMetrics();
196 QString elided = fm.elidedText(text, Qt::ElideRight, rect.width());
197
198 QPalette palette = this->palette();
199 painter->setPen(palette.color(QPalette::Text));
200
201 // 绘制文本
202 painter->drawText(rect, alignment, elided);
203
204 painter->restore();
205}
206
207void CCheckBoxHeader::mousePressEvent(QMouseEvent *event)
208{

Callers 1

paintSectionMethod · 0.95

Calls 1

isEmptyMethod · 0.45

Tested by

no test coverage detected