Change scrollbar background color keeping OS X style



  • Hi,

    How can I change the background color of a scrollbar of a QListWidget without loosing OS X style?

    I tried:

    • Setting the background color in the stylesheet of the QListWidget but is not applied to the scrollbar.

    • Setting the background color in the stylesheet of the scrollbar but then I loose the OS X style.

    • Changing the background color of the scrollbar using QPallete in this way:

    QPalette pal(palette());
    pal.setColor(QPalette::Background, Qt::black);
    ui->listWidget->verticalScrollBar()->setAutoFillBackground(true);
    ui->listWidget->verticalScrollBar()->setPalette(pal);
    

    I would appreciate any help. Thanks!!

    Edited: Use ``` (3 backticks) instead of @ for code blocks - p3c0


  • Lifetime Qt Champion

    Hi,

    You can try to create your own style based on QMacStyle.

    Hope it helps


Log in to reply
 

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