Connect Designer Created Signal To Slot In Another Class
-
My project has a Designer built gui. I need to connect a menu item signal to a slot in another class. I can find no way to do that using the signals and slots editor. I know I must be missing something, but can't figure out what it is. So far, the docs haven't helped.
I thought of connecting the menu item slot to the other class slot, but don't how to go about it. Controller class in between, maybe?
-
Hi
So you have a QMenu in Mainwindow and what to connect that to some other class that is
not MainWindow? -
Hi
Im not sure you can do that with the signals and slot editor.
So you have to do it from code when you create an instance of that other class.pseudo code
Myclass* c= new MyClass; connect( ui->Action, Qction::triggered, c, MyClass::SomeSlot )
-
Thank you.
Here is the actual code that is working for me.
CleoArea *cArea = new CleoArea; connect(ui->actionZoom_In, &QAction::triggered, cArea, &CleoArea::updateAll);
I have verified that updateAll is being called by the signal slot mechanism. Unfortunately, updateAll does not itself function properly when the mouse cursor is not over the central widget, which is another problem.
I will mark this thread as Solved and if need be, open a new one on the mouse cursor location issue.
Thank you again. This forum is much appreciated.