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. Styling of Scroll Bars in QscrollArea
Qt 6.11 is out! See what's new in the release blog

Styling of Scroll Bars in QscrollArea

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 579 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.
  • J Offline
    J Offline
    Jira
    wrote on last edited by
    #1

    Hi I have the following code in which a pointer variable of QScrollArea has been assigned widgets in a loop.

    Now I want to style horizontal scroll bars as they are white and transparent when I use them to scroll.

    I have made the following changings to set 'off' the scroll bar for confirmation but nothing is happening.

    I think i am not utilizing the the QScrollArea variable "pSArea" correctly.

    CODE:

    QScrollArea* pSArea = (QScrollArea*)widget(i);
    ShaderEditor* sEditor = (ShaderEditor*)pSArea->widget();
    pSArea->setBackgroundRole(QPalette::Dark);
    pSArea->setAutoFillBackground(true);
    pSArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Try
      QScrollArea* pSArea = qobject_cast <QScrollArea*> ( widget(i) );
      if( pSArea ) {
      pSArea->setBackgroundRole(QPalette::Dark);
      pSArea->setAutoFillBackground(true);
      pSArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      } else
      qDebug() << "cast failed";

      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