Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Change scrollbar background color keeping OS X style

    General and Desktop
    os x
    2
    2
    1387
    Loading More Posts
    • 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.
    • C
      Cesius last edited by p3c0

      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

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

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

        Hope it helps

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 1
        • First post
          Last post