Signals not emitted when the window is hidden



  • I have just run into a problem with my program when the main window is not shown. This is intended for a "batch processing" mode in which the GUI is not needed.

    The problem is that the signals such as "editingFinished" that connect the ui objects to my program functions are not being fired even though I'm actually attempting to change the contents of those ui objects via program commands. Thus, the functions that should be executed when those ui objects are changed are not being called.

    Is there a way to tell Qt that I want those signals to be fired even though the window is not visible?

    Here's some of the code that emits the "editingFinished" signal when the window is visible but not when it is hidden:

    		m_uiElement->setStyleSheet(m_ActiveBackgroundColorStyleSheet);
    		m_uiElement->setFocus();
    

    Thanks!



  • "editingFinished" is emitted on hitting the Enter/Return key or on loosing focus on that widget. A hidden widget will never get keyboard-events or focus events, so there's no trigger for that signal.

    If you are changing properties of an widget via program there may be other signals that can be used like "textChanged".
    Another way to implement what you need is to emit a self defined signal form the code the does the changes and react on this.

    regards
    gerd



  • That is helpful. Thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.