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. Automatic touch simulation on rectangle component in QML

Automatic touch simulation on rectangle component in QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 916 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.
  • R Offline
    R Offline
    ravi77
    wrote on last edited by raven-worx
    #1

    I wanted to simulate automatic click event on rectangle component in QML code.

    I have requirement as bellow.
    .qml file:

    import QtQuick 2.6
    import QtQuick 2.6
    import QtQuick.Window 2.2
    import QtQuick.Controls 2.1
    import QtQuick.Controls 2.1
    Window {
    id :root
    visible: true
    width: 640
    height: 480

    Rectangle{
        id:child1
        color: "green"
        height: 100
        width:100
        x:20
        y:60
        MouseArea{
            visible: true
            anchors.fill: parent
            id:child1MA
            onClicked: {
                console.log("Clicked")
            }
    

    Timer {
    interval: 2000
    repeat: false
    running: true
    onTriggered:
    //call function simulate touch here//
    }
    }
    }

    so when click simulation happens on rectangle, "Clicked" message has to log on consol

    thank you

    Edit raven-worx: moved topic

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

      Mouse Area has signals and signals can be called directly. Based on your condition you can call the MouseArea signals directly.

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

      1 Reply Last reply
      1

      • Login

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