How to set the receiver of a button?
-
Hi, I'm a total newbie here. I've created a class that is for handling the signals and slots of my buttons. But how do I connect my button to that new class?
I feel like I'm making unnecessary trouble by putting my slots into this new class of mine, instead of just putting them into the existing MainWindow class.
-
Hi and welcome to devnet,
For the how: create an instance of that class and connect as described in the documentation.
That said, there's nothing wrong in having slots in your QMainWindow subclass. Just beware of not making it a god class that does anything and everything in your application. You must take the time to create a sane architecture for your application.