Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSS to QStyle
Forum Updated to NodeBB v4.3 + New Features

QSS to QStyle

Scheduled Pinned Locked Moved General and Desktop
qstyleqssqcommonstyleqplaintextedit
1 Posts 1 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nen777w
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved