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. [UNSOLVED]QScrollBar with big handle
Forum Updated to NodeBB v4.3 + New Features

[UNSOLVED]QScrollBar with big handle

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 3.2k Views 1 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.
  • M Offline
    M Offline
    mbnoimi
    wrote on last edited by
    #1

    Hi,

    How can I modify the handle size of QScrollBar using stylesheets?

    I tried the following but it didn't affect on width of the handler (I want it very big because I'm using Qt widget under Android)

    [code] QScrollBar:vertical {
    border: 2px solid grey;
    background: #32CC99;
    width: 15px;
    margin: 22px 0 22px 0;
    }
    QScrollBar::handle:vertical {
    background: white;
    min-height: 20px;
    }

    /**** I WANT A BIG HANDLE HERE!!! ****/
    QScrollBar::handle:vertical:hover {
    background: red;
    min-width:100px;
    }

    QScrollBar::add-line:vertical {
    border: 2px solid grey;
    background: blue;
    height: 20px;
    subcontrol-position: bottom;
    subcontrol-origin: margin;
    }

    QScrollBar::sub-line:vertical {
    border: 2px solid grey;
    background: #32CC99;
    height: 20px;
    subcontrol-position: top;
    subcontrol-origin: margin;
    }
    QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
    border: 2px solid grey;
    width: 3px;
    height: 3px;
    background: white;
    }

    QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
    background: none;
    }[/code]

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbnoimi
      wrote on last edited by
      #2

      Bump it :)

      Do you've any suggestion guys?

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pmoglaikar
        wrote on last edited by
        #3

        Hi mbnoimi,

        you can try for like this

        /**** I WANT A BIG HANDLE HERE!!! ****/
        QScrollBar::handle:vertical:hover {
        background: red;
        min-width:100px;
        margin: 0 100px 0 100px;
        }

        or in other way you inherit the QScrollbar class into custom class and reimplment the paint event and modify as you want....

        As far as i know handle size is bound to its parent size i.e. QScrollbar size if we keep QScrollbar size like 20 in width then max width size for handler is 20 unless & unitl we are not reimplement it and modify as we want apart from style sheet.

        Thanks
        Prashant Moglaikar

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mbnoimi
          wrote on last edited by
          #4

          [quote author="Prashant Moglaikar" date="1399353126"]Hi mbnoimi,

          you can try for like this

          /**** I WANT A BIG HANDLE HERE!!! ****/
          QScrollBar::handle:vertical:hover {
          background: red;
          min-width:100px;
          margin: 0 100px 0 100px;
          }

          [/quote]

          This doens't work because it strict with QScrollbar width!

          bq. or in other way you inherit the QScrollbar class into custom class and reimplment the paint event and modify as you want....

          You mean there no way to modify it wihotut class custmozation?!

          I didn't expect this complication.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            Did you try QApplication::setGlobalStrut? It controls the minimum size of elements that you interact with.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mbnoimi
              wrote on last edited by
              #6

              [quote author="Andre" date="1399392407"]Did you try QApplication::setGlobalStrut? It controls the minimum size of elements that you interact with.[/quote]

              How this will help me if I want to view the big size of scroll handle only and just only on hover event?

              In simple words; I want to increase handle's size only when I put my finger over it, otherwise the scroll should be a small.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mbnoimi
                wrote on last edited by
                #7

                BTW; I tested this solution before as mentions "in this post":http://doc.qt.digia.com/qq/qq09-q-and-a.html#scrolls

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  [quote author="mbnoimi" date="1399533204"][quote author="Andre" date="1399392407"]Did you try QApplication::setGlobalStrut? It controls the minimum size of elements that you interact with.[/quote]

                  How this will help me if I want to view the big size of scroll handle only and just only on hover event?

                  In simple words; I want to increase handle's size only when I put my finger over it, otherwise the scroll should be a small.[/quote]
                  It won't, but that requirement was not clear to me from your previous posts.

                  I suggest you look at using QML instead. It is way easier to make dynamic UI's like you seem to be after than using widgets.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mbnoimi
                    wrote on last edited by
                    #9

                    [quote author="Andre" date="1399536323"]
                    It won't, but that requirement was not clear to me from your previous posts. [/quote]
                    You mean there is no easy way to do it in QtWidgets?
                    [quote author="Andre" date="1399536323"]
                    I suggest you look at using QML instead. It is way easier to make dynamic UI's like you seem to be after than using widgets.
                    [/quote]
                    I made a discussion about QtQuick before as mentioned "in this post":http://qt-project.org/forums/viewthread/32085/ and I couldn't move to QML because if hasn't open source designer similar to Qt Designer and I don't want to design the GUI from the source code.

                    BTW; The only thing forced me to use Qt is the GUI Designer without it I'll definitely migrate to Web Frameworks (I made some successful tiny projects using "Wt":http://www.webtoolkit.eu/wt); So it's vital matter for me to design my apps graphically.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andre
                      wrote on last edited by
                      #10

                      It does in my version of Creator... And yes, I do mean that changing widget sizes on hover, especially in a nice, animated way, is very very hard to realize with QWidgets. OTOH, also realize that there really isn't a hover event on touch screen systems. At least, not on the ones I know off, although I do know about research devices that also detect a finger hovering over a screen.

                      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