Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

change the size of the slider of the qscroolBar without having to use the stylesheet



  • hello ,
    i'm trying to change the size of the slider linked to my scrollBar i need to change this size each time so i looked in the class of qscrollBar and didn't find anything that allow me to change the size of the scroller so i need your help

    i don't want to use each time the stylesheet to do that .

     setStyleSheet(QString("QScrollBar:horizontal{background-color: %2; border: 2px solid %2; border-radius: 1px; margin: 0px; height:15 px;}"
                              "QScrollBar::handle:horizontal{background-color: %1 ; min-width:30;}"
                              "QScrollBar::add-line:horizontal {border: none; background: none;}"
                              "QScrollBar::sub-line:horizontal {border: none; background: none;}"
                             ).arg(Q2UiColorsLocator::get().getDispBackground().name(), Q2UiColorsLocator::get().getDispText().name(), Q2UiColorsLocator::get().getDisabled().name()));
    
    

    this is what i did that should be initialized in the constructor and don't want to use it again in my code .... tha's why i'm looking for another idea to resize the scroller. Help!!!!!



  • As this has nothing particular to do with mobile or embedded systems, you will have a better chance of getting suggestions on a forum that is purposed for this kind of issues


  • Lifetime Qt Champion

    Hi
    Just as a note.
    You can apply a style sheet to the Application - then it will affect whole application.
    So you can set this ONCE and have all scrollbars follow it.


Log in to reply