Hello,

I'm new to python and pyqt5/pyqtgraph.  Trying to add an action/item to the 
context menu of a PlotWidget using the code below.  The New_Item appears 
overlaid on top of the "View All" item in the context menu (see picture) 
instead of above it.  I'd appreciate guidance with fixing this problem.  
Thanks in advance for the help!

from PyQt5 import QtWidgets
import pyqtgraph as pg

class Plot(pg.PlotWidget):
        
    def contextMenuEvent(self, event):
        menu = QtWidgets.QMenu(self)
        someAction = menu.addAction('New_Item')

        res = menu.exec_(event.globalPos())
        if res == someAction:
            print('Hello')

if __name__ == '__main__':
    import sys
    app = QtWidgets.QApplication(sys.argv)
    plot = Plot()
    plot.show()
    sys.exit(app.exec_())

 [image: context_menu.png]

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/95df43ef-e8db-42b7-bbef-005e8ad507c0n%40googlegroups.com.

Reply via email to