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. How to know push button is about to click?
Forum Updated to NodeBB v4.3 + New Features

How to know push button is about to click?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 394 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.
  • L Offline
    L Offline
    Lee908
    wrote on last edited by
    #1

    Hello,

    I want to do something before the button is clicked. Is there any signal or event to achieve that? Just like 'AboutToClic'k or 'PrePressEvent'? Thanks in advance.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      No. What sort of "something" did you have in mind?

      L 1 Reply Last reply
      0
      • C ChrisW67

        No. What sort of "something" did you have in mind?

        L Offline
        L Offline
        Lee908
        wrote on last edited by
        #3

        @ChrisW67

        I plan to click button to show a pop-up window and hide it when click that button again. It's working well when click the button firstly. But at the second click, that window is hidden and then displayed right away. I think the root cause is that the button-clicked signal is emitted after pop-up window lose focus and disappear. In slot function, window's visibility is false, so it's set to be true again. I want to call my slot function before pop-up window lose focus.

        jsulmJ 1 Reply Last reply
        0
        • L Lee908

          @ChrisW67

          I plan to click button to show a pop-up window and hide it when click that button again. It's working well when click the button firstly. But at the second click, that window is hidden and then displayed right away. I think the root cause is that the button-clicked signal is emitted after pop-up window lose focus and disappear. In slot function, window's visibility is false, so it's set to be true again. I want to call my slot function before pop-up window lose focus.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Lee908 said in How to know push button is about to click?:

          But at the second click, that window is hidden and then displayed right away.

          Sounds like a bug in your code. If you show it maybe somebody will find the issue.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          L 1 Reply Last reply
          1
          • jsulmJ jsulm

            @Lee908 said in How to know push button is about to click?:

            But at the second click, that window is hidden and then displayed right away.

            Sounds like a bug in your code. If you show it maybe somebody will find the issue.

            L Offline
            L Offline
            Lee908
            wrote on last edited by
            #5

            @jsulm

            It's not a bug. The popup window will disappear when click anywhere out of it. And then button-clicked signal triggers slot to change that window's visibility. So it turns to be shown again.

            jsulmJ 1 Reply Last reply
            0
            • L Lee908

              @jsulm

              It's not a bug. The popup window will disappear when click anywhere out of it. And then button-clicked signal triggers slot to change that window's visibility. So it turns to be shown again.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Lee908 If you just want to hide the pop-up window - why do you need a button for that? It disappears anywaqy as soon as user clicks somewhere else.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              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