Nominate our 2022 Qt Champions!

QSS to QStyle

  • Hi!
    This code applied to QPlainTextEdit:

    background-color: rgb(63, 67, 66);
    border-style: outset;
    border-width: 1px;
    border-radius: 6px;
    border-color: rgb(63, 67, 66);
    padding: 6px;

    allows get the rounded text edit field with given bckgnd color.
    But, how I can do the same in style class (derrived from QCommonStyle) ?
    I little bit investigate the code and all that I can do it's only:

    void MyStyle::drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const
        case CE_ShapedFrame:
                    p->setRenderHint(QPainter::Antialiasing, true);
                    p->setPen(QPen(QColor(63,67,66), f->lineWidth));
                    p->drawRoundedRect(f->rect, 6, 6, Qt::AbsoluteSize);

    But it influence only on a frame, but not on background.

    Could I define my draw style for a QPlainTextEdit with a QStyle/QCommonStyle inheritance?