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. Change scrollbar background color keeping OS X style
Forum Updated to NodeBB v4.3 + New Features

Change scrollbar background color keeping OS X style

Scheduled Pinned Locked Moved General and Desktop
os x
2 Posts 2 Posters 1.5k Views 2 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.
  • C Offline
    C Offline
    Cesius
    wrote on last edited by p3c0
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      1

      • Login

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