Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QT force ListView to beginning after suspending mouse input
Forum Updated to NodeBB v4.3 + New Features

QT force ListView to beginning after suspending mouse input

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
qt 4.8qmllistviewflickabletouch issue
1 Posts 1 Posters 948 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.
  • G Offline
    G Offline
    gsmith
    wrote on 6 Mar 2016, 18:30 last edited by
    #1

    I am running a qt application on an embedded linux display. When a function is called, I suspend the mouse input temporarily. When this happens, our listview will get stuck between 2 items. What I want to happen is for the listview to return to the beginning element. Is there any way I can do this? Here is my code below that I have tried:

    c++

    void MyApp::tempDisableTouch()
    {
    QWSServer::instance()->suspendMouse();
    setIsTouchDisabled(true);
    }
    qml

    ListView {
        id: flickable
        property bool indexChanged: false
        anchors.fill: parent
        focus: true
        highlightRangeMode: ListView.StrictlyEnforceRange
        orientation: ListView.Horizontal
        snapMode: ListView.SnapOneItem
        boundsBehavior: Flickable.StopAtBounds
        flickableDirection: Flickable.HorizontalFlick
        model: list
        onContentXChanged: {
            if (myApp.isTouchDisabled) {
                flickable.positionViewAtIndex(0, ListView.Beginning);
            }
        }
    }
    

    From my understanding, positionViewAtIndex inside onContentXChanged should be what I want to use to force the listview to return to the first element. However, there are occasions when the listview will get stuck in the middle of index 0 and index 1. Is there something I am missing? Anything else I can try to force the lisview to return to the first element after disabling the mouse. Any help would be greatly appreciated.

    1 Reply Last reply
    0

    1/1

    6 Mar 2016, 18:30

    • Login

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