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. A vexing problem with the order of signals between a text input and a button [SOLVED]

A vexing problem with the order of signals between a text input and a button [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.0k Views 1 Watching
  • 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
    Little Red Wolf
    wrote on last edited by
    #1

    I have a bit of a vexing problem. I have a text input, that after it loses focus, fires a slot that sets a label on the form and begins an operation. This is fine. However when the user clicks the cancel button on the form while the text input has focus, it necessarily causes the text input to lose its focus. Even though the user wants the window to go away, which it does, the label text and operation begin, and the user sees this for a split second. I need to figure out a way to not fire the lost focus signal if the user clicks the cancel button. I am not sure how to achieve that with Qt.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pcmantinker
      wrote on last edited by
      #2

      I'm not sure what you're trying to achieve. It makes sense that the text box will lose focus when a button is clicked. This is standard behavior. The only thing I can think of is to keep track of the currently focused widget within your window and then return focus to the last focused widget when the user clicks Cancel. Do you have any sample code demonstrating the problem?

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Little Red Wolf
        wrote on last edited by
        #3

        I solved it. I was trying to achieve responding to the text box losing focus in a different way if the cancel button was clicked. The way I did this was to check to see that whatever widget did have focus was not the cancel button.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pcmantinker
          wrote on last edited by
          #4

          I'm glad to hear you solved the problem.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mlong
            wrote on last edited by
            #5

            Please be sure and edit the thread title to add [Solved]. Thanks!

            Software Engineer
            My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

            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