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
    {
        switch(element)
        {
        case CE_ShapedFrame:
    		{
                    p->save();
                    p->setRenderHint(QPainter::Antialiasing, true);
                    p->setPen(QPen(QColor(63,67,66), f->lineWidth));
                    p->setBrush(QColor(63,67,66));
                    p->drawRoundedRect(f->rect, 6, 6, Qt::AbsoluteSize);
                    p->restore();
            }
        };
    }
    

    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?



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.