Nominate our 2022 Qt Champions!

Timer to know how much time is the mouse not moving

  • Hi,

    I am working in a project where I need to move Rectangles, and drag them over other rectangles. Once they are overlapped, the rectangle that is not beeing dragged has to change its opacity.
    For the moment, I know how to drag a Rectangle and detect when it is over an other and change the opacity of the second one.
    The problem is that I would like to user to hold the draged rectangle a second over the other rectangle before it becomes transparent.
    Is there a way to put a timer on how much time is the mouse over the target rectangle (the one to become transparent) and trigger the opacity change after a second?

    Thank you :)

  • Have you already taken a look at the "Timer": element? It can be used as a single-shot timer as well, activated once the Rectangles overlap and triggered after a second, reducing the opacity of the Rectangle.

  • Hi!
    First, thank you for the quick answer ^^
    Timer is just what I was looking for ;) I did what I wanted and I event put a little animation :)
    Thanks a lot.

    I have just a quick question about another thing, if you don't mind:
    How should I comment my QML files if I use doxygen documentation? I mean, what syntax should I use in order to make doxygen recognise it?

    thank you again ;)

Log in to reply