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. how to separate scrolling and touch events in a layout with tableview on touch screen.
Forum Updated to NodeBB v4.3 + New Features

how to separate scrolling and touch events in a layout with tableview on touch screen.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 197 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.
  • JoeCFDJ Offline
    JoeCFDJ Offline
    JoeCFD
    wrote on last edited by JoeCFD
    #1

    Qml file structure is as follows:

    GroupBox {
         id: root
         title: ""
    
         label: Label {
              text: root.title
         }
        
         Flickable {
              id: flickable
        
                TableView {            
                     .........
                     ScrollBar.vertical: VerticalScrollBar {
                            id: scrollBar
                            anchors.right: parent.right
                    }
                }
           }    
    
          MouseArea {
                   id: mouseArea
                   anchors.fill: parent
                   propagateComposedEvents: true
           
                   onPressed: {
                       console.log("Touch pressed at:", mouse.x, mouse.y);
                   }
    
                   onClicked: {
                       console.log("Touch clicked at:", mouse.x, mouse.y);
                   }
               }
    }
    

    MouseArea is added to get touch events to pop-up another item. If mousearea is added, scrolling for TableView will not work. How to use pressed or clicked event without affecting scrolling in TableView. No help with higher z value in either tableview or mousearea.

    No issues if mouse is used. Scrolling in tableview is blocked only by touch on touch screen.

    Any help will be appreciated.

    OS: Yocto
    Qt: 5.15.13

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by dheerendra
      #2

      You are using the TableView from Controls 1. You can solve this by defining rowDelegate & defining the MouseArea responses.
      Scrolling works as is. No need to define flickable as well.
      e.g

      TableView {
             rowDelegate: Rectangle {
                      id : rowDelegate
                      height: 100
                      MouseArea { 
                      }
             }
      }
      

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      JoeCFDJ 1 Reply Last reply
      0
      • dheerendraD dheerendra

        You are using the TableView from Controls 1. You can solve this by defining rowDelegate & defining the MouseArea responses.
        Scrolling works as is. No need to define flickable as well.
        e.g

        TableView {
               rowDelegate: Rectangle {
                        id : rowDelegate
                        height: 100
                        MouseArea { 
                        }
               }
        }
        
        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #3

        @dheerendra Thank you for your reply. I do not use TableView from Controls 1. Instead, TableView: QtQuick is applied. Flickable is not the issue. Touch event handling in Qml is the problem. Mouse works just fine.

        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