Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Button timer
Forum Update on Monday, May 27th 2025

Button timer

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 1.1k 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.
  • A Offline
    A Offline
    alecs26
    wrote on last edited by
    #1

    Hello,

    I have a button that opens a form when clicked. I would like the button to be pressed if the cursor is over the button for 2 seconds. How could I do this ?

    Thank you very much,

    Alex

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You can do that with focusInEvent / focusOutEvent and either a QTimer or timerEvent combo.

      Note however that it's going to likely be pretty strange for your users to have a dialog popping up just because they left the cursor on the button.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alecs26
        wrote on last edited by
        #3

        Thank you very much for your help !

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alecs26
          wrote on last edited by
          #4

          Hi,

          I created a timer but I get a warning in the design tab:
          "This type (Timer) is not supported in the Qt Quick Designer (M204).
          Any idea ?

              Timer
              {
                  id:timer1
                  interval:1000
                  repeat:false
                  running:false
                  onTriggered:rectangle11.visible=true
              }
          

          Thank you very much,

          Alex

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            What version of Qt Creator are you using ?

            There was a solved bug report about it here.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • A Offline
              A Offline
              alecs26
              wrote on last edited by
              #6

              Qt Creator 4.2.0
              Based on Qt 5.7.1 (MSVC 2015, 32 bit)
              Build on Dec 9 2016

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                There might have been a regression.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  alecs26
                  wrote on last edited by
                  #8

                  Thanks, I will igrore this warning for now...

                  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