PDA

View Full Version : Modify triggered signal on QAction



Marcofe
28th October 2013, 10:20
Hello,
i need to modify triggered signal on Qaction. The best way to make this is to extend Qaction class, or exist an alternative way?
Tnx so much

aamer4yu
28th October 2013, 10:44
What do you want to modify ?

A clean approach would be to catch the triggered signal in some slot, do your conversions, and emit another signal .

You can also extend (aka inherit ) QAction class, but if you are not using that class in lot many places, then no use to create a separate class for the task.

Marcofe
28th October 2013, 12:09
Tnx for your answer,
so my problem is to have a triggered signal with an int. For example i'd use triggered signal like:


connect ( move, SIGNAL ( triggered(int) ), this, SLOT ( function(int) ) );

instead of


connect ( move, SIGNAL ( triggered() ), this, SLOT ( function() ) );

and i thought to extend Qaction class..is this a good solution?Is it possible?
tnx

aamer4yu
28th October 2013, 12:41
Why do you need the int argument ?

In my opinion just avoid extending till its absolutely necessary.
You could use QAction::data() or the parent widget to retrieve the necessary int information...

If you tell in detail how you want to implement QAction, we can perhaps provide an alternative solution

anda_skoa
28th October 2013, 13:31
Also see QSIgnalMapper

Cheers,
_