Results 1 to 2 of 2

Thread: QShortcuts with the same key, different widgets

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2007
    Posts
    19
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default QShortcuts with the same key, different widgets

    Hi, I create two shortcuts like this: (slotRemove is different in the two widgets)
    Qt Code:
    1. QShortcut* del = new QShortcut(QKeySequence(Qt::Key_Delete),widget1);
    2. connect(del, SIGNAL(activated()),widget1, SLOT(slotRemove()));
    3.  
    4. QShortcut* del2= new QShortcut(QKeySequence(Qt::Key_Delete),widget2);
    5. connect(del2, SIGNAL(activated()),widget2,SLOT(slotRemove()));
    To copy to clipboard, switch view to plain text mode 
    where widget1 is a QTableWidget and widget2 is a QTableView with custom model. The problem is that if I press delete in the tree, the slot is called correctly, however if I then try to press delete in the table, nothing happens, and delete no longer works correctly in the tree. In fact, nothing happens at all after I try to 'switch' and press delete. The same happens if I reverse the order (table first, tree second). I tried to change the contexts, but it did not work. Am I missing something here?

  2. #2
    Join Date
    Mar 2007
    Posts
    19
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: QShortcuts with the same key, different widgets

    Nevermind, I fixed it by defining the ambiguous function as the same as the non ambiguous function.

Similar Threads

  1. New widgets after application begins
    By petty in forum Newbie
    Replies: 5
    Last Post: 8th May 2007, 12:10
  2. Performance in hiding/showing widgets
    By Paalrammer in forum Newbie
    Replies: 12
    Last Post: 14th February 2007, 18:57
  3. Replies: 11
    Last Post: 7th July 2006, 13:09
  4. How to movable dock widgets?
    By becond in forum Qt Tools
    Replies: 3
    Last Post: 21st February 2006, 19:57
  5. Creating Widgets
    By hylke in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2006, 08:37

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
  •  
Qt is a trademark of The Qt Company.