Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Scrollbar visibility in QML QridView and Flickable
Forum Updated to NodeBB v4.3 + New Features

Scrollbar visibility in QML QridView and Flickable

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 5.0k 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.
  • L Offline
    L Offline
    Locate
    wrote on last edited by
    #1

    I use QtQuick 2.5 and QtQuick.Controls 2.0 in my QML-Application. For Scrolling in my Windows I us Flickable. The Scrollbar is only visible if the Scrollbar is pressed or if ist Scrolling. Same is in GridViews. Is there a psibility that the scrollbar is always visible.

    Julien BJ 1 Reply Last reply
    0
    • L Offline
      L Offline
      Locate
      wrote on last edited by
      #3

      I found a slution that seems to work.

              ScrollBar.vertical: ScrollBar {
                  active: true;
      
                  onActiveChanged: {
                      if (!active)
                          active = true;
                  }
              }
      
      1 Reply Last reply
      3
      • L Locate

        I use QtQuick 2.5 and QtQuick.Controls 2.0 in my QML-Application. For Scrolling in my Windows I us Flickable. The Scrollbar is only visible if the Scrollbar is pressed or if ist Scrolling. Same is in GridViews. Is there a psibility that the scrollbar is always visible.

        Julien BJ Offline
        Julien BJ Offline
        Julien B
        wrote on last edited by Julien B
        #2

        Hello @Locate

        The solution below works but it is not very satisfying.

        It seems adding active: true in a ScrollBar is not enough but I don't know why.

        import QtQuick 2.7
        import QtQuick.Controls 2.0
        
        Rectangle {
            id: demo
            width: 800
            height: 600
            color: "#ff303030"
        
            Flickable {
                id: flick
                anchors.fill: parent
        
                contentWidth: parent.width * 2
                contentHeight: parent.height * 2
        
                ScrollBar.horizontal: ScrollBar {
                    active: flick.moving || !flick.moving
        
                    // The one below does not nork more than once and the scrollbar
                    // goes invisible after the first move
                    //active:true
                }
                ScrollBar.vertical: ScrollBar {
                    active: flick.moving || !flick.moving
                }
            }
        }
        
        1 Reply Last reply
        0
        • L Offline
          L Offline
          Locate
          wrote on last edited by
          #3

          I found a slution that seems to work.

                  ScrollBar.vertical: ScrollBar {
                      active: true;
          
                      onActiveChanged: {
                          if (!active)
                              active = true;
                      }
                  }
          
          1 Reply Last reply
          3

          • Login

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