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. Multiple focus causing multiple event triggered
Qt 6.11 is out! See what's new in the release blog

Multiple focus causing multiple event triggered

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.7k 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.
  • D Offline
    D Offline
    donitaroid
    wrote on last edited by
    #1

    I made a dialog like this by Qt Designer.

    !http://img5.imageshack.us/img5/7207/stxp.png(PICTURES)!
    The "QLineEdit B" and "button a" were both blue-bordered.

    I connected the signal returnPressed() from "QLineEdit B" to function onInputEnterPressed(), and connected signal pressed() from "button a" to refreshInformation(). I noticed that when I finished fill QLineEdit B and press enter, both onInputEnterPressed() and refreshInformation() was triggered(which means the returnPressed() of "QLineEdit B" is emitted, and the pressed() signal from "button a" is also emitted, too). How can I do to prevent the refreshInformation() being triggered unexpectedly?
    !http://img541.imageshack.us/img541/2944/3n02.png(here is a picture, if you can't see it, please report to me)!

    Another question, Is that normal to have two focuses in identical window?

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

      Hi,

      What is signal pressed() ?

      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
      • D Offline
        D Offline
        donitaroid
        wrote on last edited by
        #3

        Oh, I'm sorry. I forgot to provide the sender. The pressed() is a signal from QPushButton.

        I connected the signal pressed() from button a to refreshInformation(), and connected the signal returnPressed() from QLineEdit B to onInputEnterPressed().

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

          Are you sure that one function is not calling the other ?

          Otherwise, can you share the relevant piece of code ?

          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

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved