PDA

View Full Version : Contex menu appear multiple times



kubas
7th September 2009, 12:44
Hey,
i have this issue:

i added contexmenu to qtreewidget


tree.setContextMenuPolicy(ContextMenuPolicy.Custom ContextMenu);
tree.customContextMenuRequested.connect(this, "treeMenu(QPoint)");

....

private void treeMenu(QPoint point)
{
QMenu menu = new QMenu(tree);
... add some actions ...
menu.exec(ui.tree.mapToGlobal(point));
}


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

caduel
7th September 2009, 14:26
another cause might be that you (maybe) connect 3 times to that signal; check that, too.

kubas
7th September 2009, 14:55
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