Results 1 to 2 of 2

Thread: How to deal with shorcouts in many widgets

  1. #1
    Join Date
    Dec 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default How to deal with shorcouts in many widgets

    How can I share the same shorcout between widgets?

    I'm adding all the QActions I have to the applications main window widget, more precisely im adding Cut, Copy, and Paste actions. I have a QTabWidget as main window central widget. So I want to be able to use my actions in all my QTabWidget childs (the tabs), for example, i'm creating a custom texteditor, inheriting only from QWidget, how do I implement my editions(cut, copy..) actions?.

    I have tried sharing the same actions objects between all the widgets, connecting them to my widget slots, but then, when I press the action shourcut, all the widgets get the event at the same time. I tried also overrading keyPressEvent in child widgets, but for some reason the shourcout events never trigers that slot, probably because the QAction created in the main window intercept them.


    I can only think on one solution, handling all my logic at one place (in the main window), but it seems unatural.

    Thank you.

  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: How to deal with shorcouts in many widgets

    May be you can use QAction::triggered to connect to your child widgets

Similar Threads

  1. Replies: 5
    Last Post: 31st December 2010, 11:49
  2. Replies: 7
    Last Post: 14th January 2010, 08:47
  3. Replies: 0
    Last Post: 15th May 2009, 15:38
  4. How to deal with jpeg deployment problem with Visual C++ compiler
    By nooky59 in forum Installation and Deployment
    Replies: 5
    Last Post: 27th March 2008, 11:20
  5. Replies: 12
    Last Post: 23rd March 2007, 09:23

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.