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. ScrollView: interactive
QtWS25 Last Chance

ScrollView: interactive

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
8 Posts 3 Posters 1.8k Views
  • 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.
  • D Offline
    D Offline
    DiegoDonate
    wrote on last edited by
    #1

    I have problems with my QML ScrollViews in a Qt application. I can not avoid the interactive mode, even setting the property to 'false'

    For testing, I have the docu QML example loaded in a QQuickView:

    main.cpp:

    int main(int argc, char *argv[])
    {   
        QGuiApplication a(argc, argv);
    
        QQuickView* pView = new QQuickView();
        pView->setSource(QUrl("qrc:/TestScroll.qml"));
        pView->setColor("white");
        pView->setHeight(400);
        pView->setWidth(600);
        pView->show();
    
        return a.exec();
    }
    

    TestScroll.qml:

    import QtQuick 2.9
    import QtQuick.Controls 2.2
    
    ScrollView {
        width: 200
        height: 200
    
        ScrollBar.vertical.interactive: false // Not working
    
        ListView {
            model: 20
            delegate: ItemDelegate {
                text: "Item " + index
            }
        }
    }
    

    Am i doing something wrong? Is it a QT bug?

    Thanks,
    Diego

    Pradeep P NP 1 Reply Last reply
    0
    • IntruderExcluderI Offline
      IntruderExcluderI Offline
      IntruderExcluder
      wrote on last edited by IntruderExcluder
      #2

      What do you want to achieve? Your example working fine as documentation says. Scroll bar is visible but you cannot interact with it.

      1 Reply Last reply
      0
      • D DiegoDonate

        I have problems with my QML ScrollViews in a Qt application. I can not avoid the interactive mode, even setting the property to 'false'

        For testing, I have the docu QML example loaded in a QQuickView:

        main.cpp:

        int main(int argc, char *argv[])
        {   
            QGuiApplication a(argc, argv);
        
            QQuickView* pView = new QQuickView();
            pView->setSource(QUrl("qrc:/TestScroll.qml"));
            pView->setColor("white");
            pView->setHeight(400);
            pView->setWidth(600);
            pView->show();
        
            return a.exec();
        }
        

        TestScroll.qml:

        import QtQuick 2.9
        import QtQuick.Controls 2.2
        
        ScrollView {
            width: 200
            height: 200
        
            ScrollBar.vertical.interactive: false // Not working
        
            ListView {
                model: 20
                delegate: ItemDelegate {
                    text: "Item " + index
                }
            }
        }
        

        Am i doing something wrong? Is it a QT bug?

        Thanks,
        Diego

        Pradeep P NP Offline
        Pradeep P NP Offline
        Pradeep P N
        wrote on last edited by Pradeep P N
        #3

        @DiegoDonate

        Do you want completely disable the interactive ?
        Refer Touch vs. Mouse Interaction

        • If you want to disable Mouse Scroll Interaction :
            ScrollBar.vertical.interactive: false
            wheelEnabled: false
        

        wheelEnabled is property of Control .

        All the best.

        Pradeep Nimbalkar.
        Upvote the answer(s) that helped you to solve the issue...
        Keep code clean.

        1 Reply Last reply
        2
        • D Offline
          D Offline
          DiegoDonate
          wrote on last edited by
          #4

          Thanks for your messages. I think I did not explain my problem properly, sorry...

          What I need is to avoid the 'bounce' at the end of the scroll view when scrolling using the wheel. When I use the scrollBar for scrolling, I get no bounce at the end of the scrolling screen

          Thanks,
          Diego

          1 Reply Last reply
          0
          • IntruderExcluderI Offline
            IntruderExcluderI Offline
            IntruderExcluder
            wrote on last edited by
            #5

            Then boundsBehavior property of ListView is what you need. Also, ScrollView is not mandatory here, ListView is Flickable as itself. Example:

                    ListView {
                        width: 200
                        height: 200
                        ScrollBar.vertical: ScrollBar {
                            interactive: false
                        }
                        model: 20
                        boundsBehavior: ListView.StopAtBounds // Disable bouncing
                        delegate: ItemDelegate {
                            text: "Item " + index
                        }
                    }
            
            D 1 Reply Last reply
            1
            • IntruderExcluderI IntruderExcluder

              Then boundsBehavior property of ListView is what you need. Also, ScrollView is not mandatory here, ListView is Flickable as itself. Example:

                      ListView {
                          width: 200
                          height: 200
                          ScrollBar.vertical: ScrollBar {
                              interactive: false
                          }
                          model: 20
                          boundsBehavior: ListView.StopAtBounds // Disable bouncing
                          delegate: ItemDelegate {
                              text: "Item " + index
                          }
                      }
              
              D Offline
              D Offline
              DiegoDonate
              wrote on last edited by DiegoDonate
              #6

              @IntruderExcluder said in ScrollView: interactive:

              boundsBehavior: ListView.StopAtBounds // Disable bouncing

              Thanks, it works for my ListViews! However, I also need to disable bouncing in 2 ScrollViews with content, but no Listview... Is it possible?

              1 Reply Last reply
              0
              • IntruderExcluderI Offline
                IntruderExcluderI Offline
                IntruderExcluder
                wrote on last edited by
                #7

                For some reason there is no way to set such property or get access to inner flickable (at least without rebuilding Qt). Probably your way is to use Flickable instead of ScrollView.

                D 1 Reply Last reply
                1
                • IntruderExcluderI IntruderExcluder

                  For some reason there is no way to set such property or get access to inner flickable (at least without rebuilding Qt). Probably your way is to use Flickable instead of ScrollView.

                  D Offline
                  D Offline
                  DiegoDonate
                  wrote on last edited by
                  #8

                  @IntruderExcluder Thanks for your help

                  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