Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. can hide widget emit signal

can hide widget emit signal

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
qt4.8signals emit
6 Posts 4 Posters 3.6k 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
    Andrea
    wrote on last edited by
    #1

    Hi everybody,

    is it possible to emit a signal from an hidden widget? According to my tests, this does not seems to be allowed.

    Many thanks
    Andrea

    J.HilkJ 1 Reply Last reply
    0
    • A Andrea

      Hi everybody,

      is it possible to emit a signal from an hidden widget? According to my tests, this does not seems to be allowed.

      Many thanks
      Andrea

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @Andrea hiho,
      I'm afraid your testing went wrong somewhere, hiding a widget has no effect on it's signals. Accept of course GUI-interact signals, mouseclicks, butten clicks etc. You can't interact with stuff thats not there. But everything else e.g QTimer::timeout signals work just fine.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      2
      • A Offline
        A Offline
        Andrea
        wrote on last edited by
        #3

        @J-Hilk many thanks for your reply. In my question I'm not been clear enough.
        I've a button that allows the user to "go back to previous window" of my embedded application and, in some windows, this button has to be hidden.
        Now, what I would like to achieve is to emit the "click" signal of the button even if it is hidden, not by clicking on it from GUI, but by code, calling instruction

        emit myButton->click();
        

        When I do so, since the button (or any other widgets) is not shown, I'm unable to recall its 'click' signal, and this is a behaviour that has sense to me.

        J.HilkJ 1 Reply Last reply
        0
        • A Andrea

          @J-Hilk many thanks for your reply. In my question I'm not been clear enough.
          I've a button that allows the user to "go back to previous window" of my embedded application and, in some windows, this button has to be hidden.
          Now, what I would like to achieve is to emit the "click" signal of the button even if it is hidden, not by clicking on it from GUI, but by code, calling instruction

          emit myButton->click();
          

          When I do so, since the button (or any other widgets) is not shown, I'm unable to recall its 'click' signal, and this is a behaviour that has sense to me.

          J.HilkJ Online
          J.HilkJ Online
          J.Hilk
          Moderators
          wrote on last edited by J.Hilk
          #4

          @Andrea
          What you describe is still possible take this example:

          QPushButton *myButton = new QPushButton();
          connect(myButton, &QPushButton::clicked, this, [=]{qDebug() << "PushButton Clicked signal";});
          
          myButton->hide();
          
          myButton->clicked();
          

          You'll see PushButton Clicked signal in your consol log.

          edit:
          There is also nothing preventing you to call the SLOT, your button connects to, manualy.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

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

            Hi,

            Out of curiosity, why do you want to "simulate" a button click ?

            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
            1
            • Pablo J. RoginaP Offline
              Pablo J. RoginaP Offline
              Pablo J. Rogina
              wrote on last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              1

              • Login

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