* @brief Draws filled text at (x, y) using the active font and fill style. */
| 1299 | * @brief Draws filled text at (x, y) using the active font and fill style. |
| 1300 | */ |
| 1301 | void Widgets::PainterContext::fillText(const QString& text, qreal x, qreal y) |
| 1302 | { |
| 1303 | if (!active() || text.isEmpty()) |
| 1304 | return; |
| 1305 | |
| 1306 | const QPointF origin = alignTextOrigin(text, x, y); |
| 1307 | |
| 1308 | if (shadowActive()) { |
| 1309 | QPainterPath p; |
| 1310 | p.addText(origin, m_state.font, text); |
| 1311 | QBrush brush = m_state.fillBrush; |
| 1312 | renderWithShadow([p, brush](QPainter* qp) { qp->fillPath(p, brush); }, p.boundingRect()); |
| 1313 | } |
| 1314 | |
| 1315 | m_painter->save(); |
| 1316 | m_painter->setPen(QPen(m_state.fillBrush, 0)); |
| 1317 | m_painter->setBrush(m_state.fillBrush); |
| 1318 | m_painter->setFont(m_state.font); |
| 1319 | m_painter->drawText(origin, text); |
| 1320 | m_painter->restore(); |
| 1321 | } |
| 1322 | |
| 1323 | /** |
| 1324 | * @brief Draws stroked text at (x, y) using the active font and stroke style. |