Results 1 to 5 of 5

Thread: Modify triggered signal on QAction

  1. #1
    Join Date
    Oct 2013
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default Modify triggered signal on QAction

    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

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Modify triggered signal on QAction

    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.

  3. #3
    Join Date
    Oct 2013
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default Re: Modify triggered signal on QAction

    Tnx for your answer,
    so my problem is to have a triggered signal with an int. For example i'd use triggered signal like:

    Qt Code:
    1. connect ( move, SIGNAL ( triggered(int) ), this, SLOT ( function(int) ) );
    To copy to clipboard, switch view to plain text mode 

    instead of

    Qt Code:
    1. connect ( move, SIGNAL ( triggered() ), this, SLOT ( function() ) );
    To copy to clipboard, switch view to plain text mode 

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

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Modify triggered signal on QAction

    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

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Modify triggered signal on QAction

    Also see QSIgnalMapper

    Cheers,
    _

Similar Threads

  1. Replies: 7
    Last Post: 7th September 2013, 13:35
  2. Replies: 3
    Last Post: 10th April 2013, 17:01
  3. QAction, triggered signal dont call a slot
    By kaszewczyk in forum Newbie
    Replies: 6
    Last Post: 5th October 2010, 21:30
  4. Replies: 8
    Last Post: 10th December 2009, 10:06
  5. Replies: 2
    Last Post: 27th February 2007, 21:06

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.