Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How do I make QtDesigner see slots and signals from other classes objects?
I created a form and added a button to it, now I want one of the objects of my classes to be able to receive a signal in its slot.
The signals and slots editor obviously doesn't see the other objects.
now I want one of the objects of my classes
Where are those objects/instances created? Designer only knows about objects created inside widgets you're creating/editing in designer.
It only shows QWidgets from the same form.
It cant see other custom classes or anything like that.
So " one of the objects of my classes " means some objects you generate in code or what excatly do you mean ?
@jsulm, in other files, how do I get QtDesigner to see them?
@mrjbom you don't. You should use
connectmethod in your code.
Allow me to re-iterate what others said:
It only shows QWidgets from the same form
one of the objects of my classes
This means that I have created other classes and would like QtDesigner to see the objects of these classes.
@mrjbom usually the main window of your UI is a member of your default class (unless you changed it it is MainWindow). If you created other windows and want to connect to them you can include their header files in your main class - how to make them visible and when is what you need to code. There are some restrictions, like you should only have one QMainWindow in your program; more detail can be found in Qt Main Window Framework section of the documentation.
@artwaw, I expected that this could be fixed.
Thanks for the reply.
@mrjbom "fixed"? There is no error.
@artwaw, I did not mean that this is an error, I meant that you can force QtDesigner to see other files.
@mrjbom How should this work - how should the designer know where you instantiate those (and how often, ...)?
JonB last edited by JonB
The simple answer is: Don't bother to even try using that "Signal/Slot" set up thing at all in Designer! I think you will find most of us do not. Do your
connect()s explicitly in code. What the Designer does is pretty limited, and can have issues. Just saying.
@Christian-Ehrlicher, perhaps similar to how I use " Promoted Class"
perhaps similar to how I use " Promoted Class"
You do not understand the problem. How should the designer know how and where you create those different instances so it can somehow automatically create the connects?