Hello all, I am using a composite widget (widget of custom widgets) with a context menu. Each of my child widgets has a context menu as well.
I would like in my composite to EXTEND all the context menus of child widgets. For the composite, I tried to reimplement contextMenuEvent method (after setting setContextMenupolicy(Qt.NoContextMenu) for each of my child widget). How can I get the context menu of the childwidget in my contextEventMenu? def contextMenuEvent(self, event): ''' The context menu created each time it is clicked! ''' mousePositionAtEvent = event.pos() clickedWidget = self.childAt(mousePositionAtEvent) if clickedWidget : print "objectName %s" % (clickedWidget.objectName()) print "class %s" % clickedWidget.__class__.__name__ if getattr(clickedWidget,'createStandardContextMenu',None) : menu = clickedWidget.createStandardContextMenu() else: menu = LContextMenu(self.dataContainer, self) menu.exec_(event.globalPos()) To my surprise the clickedWidget class/objectName changes function of the child widget setContextMenuPolicy.... if ContextMenuPolicy is set to default, the composite contextMenuEvent method of the composite is bypassed. If setContextmenuPolicy is set to Qt.NoiContextMenu, the clickedWidget doesn't have the createStandardContextMenu (!?) and class is QWidget (!?!?) and object name is 'qt_scrollarea_viewport' (?!?) My question: How from my composite widget can I access the child widget context menu. (Assume those child widgets have a method createStandardContextMenu which returns their context menu!) Please help... -- Emmanuel _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt