QSignalWrapper uses wrong Method?
-
I'm coming right from Java (I was doing C++ years ago the last time...), so I assumed the Q*-Classes would all inherit from QObject. Now as I check it I see it's not like that.
As shown in the code I have the slot:
@ int addBtn(QIcon *icon = 0);@
I just want to trigger this event (Parameter included) as someone clicks another button.
How do I achieve that? -
Like I wrote before, a slot doesn't return anything.
To have something clean, you should rather have a parameterless slot where you will implement the button creation logic.
-
You can't do it with QSignalMapper. If I understand correctly when you click on that button a new one should be created with an icon, then what should happen ?
-
Like I said, do it indirectly. Have a parameterless slot where you will create the button retrieving the icon has you need it.
-
What are the exact requirements ?
-
Directly, you can't have that. Qt's signals must be connected to slots with matching signatures or less (but still matching) parameters.
QSignalMapper works with either QString, QObjects, or QWidgets. So you can't have a slot with a QIcon * parameter. However and since there's chances that you build your icon using a path to an image file, you could use that to build your new button. But as i've stated before, your slots should not have any return type other than void.