Results 1 to 3 of 3

Thread: Contex menu appear multiple times

  1. #1
    Join Date
    Sep 2009
    Posts
    7
    Thanks
    2

    Default Contex menu appear multiple times

    Hey,
    i have this issue:

    i added contexmenu to qtreewidget
    Qt Code:
    1. tree.setContextMenuPolicy(ContextMenuPolicy.CustomContextMenu);
    2. tree.customContextMenuRequested.connect(this, "treeMenu(QPoint)");
    3.  
    4. ....
    5.  
    6. private void treeMenu(QPoint point)
    7. {
    8. QMenu menu = new QMenu(tree);
    9. ... add some actions ...
    10. menu.exec(ui.tree.mapToGlobal(point));
    11. }
    To copy to clipboard, switch view to plain text mode 

    it works just fine but ..
    if i right click on it it fires up 3 times,
    so multiple times is the signal emitted.
    How to deal with it and filter the signals or block ?

    Greets,
    Kubas

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 162 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Contex menu appear multiple times

    another cause might be that you (maybe) connect 3 times to that signal; check that, too.

  3. The following 2 users say thank you to caduel for this useful post:

    kubas (7th September 2009), mclark (12th November 2010)

  4. #3
    Join Date
    Sep 2009
    Posts
    7
    Thanks
    2

    Default Re: Contex menu appear multiple times

    You were right, i connected to it 3 times.
    If i clicked, mouse sent 3 "click signals", and called this function
    which made the connection.

    Thanks very much
    I wouldnt find it by my own

    Greets,
    Kubas

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.