Slots not being called in shared library (Mac)



  • I have developed a shared library with a Qt interface. At runtime, this is dynamically loaded by an application that does not use Qt. So, it acts as a plugin to the application. When a button in the application is pressed, the shared library is called and it creates a QApplication, instantiates a dialog widget, and uses show() and app.exec() to present the GUI to the user. So far, fairly boilerplate, and it works on Mac and Windows...sorta...

    However, we don't wish to require the end-users to have Qt installed; rather, we wish to distribute the QtCore and QtGui libs with the application. On Windows, we explicitly load these two Qt libs when the shared library plugin is loaded. This works without issues. On the Mac, we use "install_name_tool" to change the location of where the plugin is to find the QtCore and QtGui libs we include with the application. Also, fairly boilerplate and it works...sorta...

    The problem on the Mac is this: the Qt dialog widget is created and appears when it is supposed to, and the various sliders, buttons, etc. respond as they should, but the slots that they're connected to fail to get called (!?). I've verified that the connect() calls succeed (return true). This problem only appears if we use "install_name_tool" and rely on the Qt libs the application provides; if instead we rely on the installed Qt frameworks, everything works just fine.

    So, it appears that Qt mostly works (in that the GUI appears and the widgets respond), but the slots don't get called.

    More relevant detail: the dialog widget in question contains a list widget and a stack widget. In the code, I explicitly add a connection between the list widget's "selected item changed" signal and a slot, and my slot does get called: I set to current stack widget to be the appropriate dialog, and that dialog appears inside the main dialog correctly. It is the widgets inside this current dialog (contained in the stack widget) whose slots never get called.

    I cannot begin to understand how the list widget's slot gets called (as well as the usual OK and Cancel buttons on the main dialog), and yet the slots connected to signals of widgets that live inside dialogs contained in the stack widget fail to get called (and again, the connect() calls are succeeding). And why would this work when using the system-provided Qt frameworks, and not when using the Qt frameworks packaged with the application (after all, it works enough to display all the Qt widgets, and call some of the callbacks)...

    I'm stumped. Any suggestions would be greatly appreciated!

    • Philip


  • Update: this all seems to work correctly if I build my own Qt libs from sources...


Log in to reply
 

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