QScrollBar stylesheet does not apply on windows



  • I want to change the style of my scrollbar in an QPlainTextEdit. But unfortunately on Windows it will always render the native windows scrollbar. On Mac OSX it works perfect. Whats the problem?

    I set the stylesheet on construction of the window like this:

    mPlainTextEdit = new QPlainTextEdit(mCentralWidget);
    mPlainTextEdit->setObjectName(QStringLiteral("LogText"));
    mPlainTextEdit->setStyleSheet(QString::fromUtf8(
        "QPlainTextEdit {"
        "    background-color: #4A4C4F;"
        "    color: #C6C8C8;"
        "    font-size: 10px;"
        "    border-style: none;"
        "}"
        "QScrollBar:vertical {"
        "    border-style: none;"
        "    background: #4A4C4F;"
        "    width: 10px;"
        "    margin: 0px;"
        "}"
        "QScrollBar::handle:vertical {"
        "   background: #555555;"
        "   border-style: solid;"
        "   border-width: 1px;"
        "   border-radius: 5px;"
        "   border-color: #555555;"
        "}"
        "QScrollBar::add-line:vertical { background: #4A4C4F; }"
        "QScrollBar::sub-line:vertical { background: #4A4C4F; }"));

Log in to reply
 

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