MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / setFillStyle

Method setFillStyle

app/src/UI/Widgets/PainterContext.cpp:549–578  ·  view source on GitHub ↗

* @brief Updates the fill style. Accepts a CSS color string OR a gradient/pattern object. */

Source from the content-addressed store, hash-verified

547 * @brief Updates the fill style. Accepts a CSS color string OR a gradient/pattern object.
548 */
549void Widgets::PainterContext::setFillStyle(const QJSValue& value)
550{
551 if (value.isString()) {
552 const QString spec = value.toString();
553 const QColor c = parseColor(spec);
554 if (!c.isValid())
555 return;
556
557 m_state.fillSpec = spec;
558 m_state.fillStyleValue = value;
559 m_state.fillBrush = QBrush(c);
560 rebindFillBrush();
561 return;
562 }
563
564 if (value.isQObject()) {
565 if (auto* g = qobject_cast<PainterGradient*>(value.toQObject())) {
566 m_state.fillBrush = g->brush();
567 m_state.fillStyleValue = value;
568 rebindFillBrush();
569 return;
570 }
571 if (auto* p = qobject_cast<PainterPattern*>(value.toQObject())) {
572 m_state.fillBrush = p->brush();
573 m_state.fillStyleValue = value;
574 rebindFillBrush();
575 return;
576 }
577 }
578}
579
580/**
581 * @brief Updates the stroke style. Accepts a CSS color string OR a gradient/pattern object.

Callers

nothing calls this directly

Calls 2

brushMethod · 0.80
isValidMethod · 0.45

Tested by

no test coverage detected