Is any Auto Repeat function for image in qml?



  • Dear Friends,

    I’m a beginner in qt. I’ve created one image as a button in qml and i need to print the text continuously in text-input if i hold the image. Is there any auto repeat function like in (qt button property). or which way and how can i achieve this. Thanks in advance…:-)



  • you can use the following:
    @
    Image {
    id: imageRect
    signal repeatedClick(variant str);

    MouseArea{
        anchors.fill: parent
        onPressed: timer.running = true;
        onReleased: timer.running = false;
    }
    
    Timer {
        id: timer
        interval: 500; running: false; repeat: true
        onTriggered: imageRect.repeatedClick("PrintMe");
    }
    
    onRepeatedClick: console.log(str);
    

    }
    @



  • It's working.......!!!!. Thank u favoritas37. Now only i saw this code and implement.



  • thanks favoritas37
    i used it.
    :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.