Results 1 to 2 of 2

Thread: contextMenuEvent clashing

  1. #1
    Join Date
    Sep 2009
    Posts
    49
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default contextMenuEvent clashing

    PyQt4

    I am sub classing QGraphicsView & QGraphicsItem.

    I do have a contextMenuEvent in both of them. How ever while right clicking on item creates the menu of view. It's not creating the menu defined in item.

    If I disable the menu of view, item's menu is working fine.

    How do I ignore this clashing?

    Here is code of Item's contextMenuEvent
    Qt Code:
    1. def contextMenuEvent(self, event):
    2. menu = QtGui.QMenu()
    3. menu.addAction("Copy")
    4. menu.addAction("Paste")
    5. menu.exec_(event.screenPos())
    To copy to clipboard, switch view to plain text mode 

    Code of view's contextMenuEvent
    Qt Code:
    1. menu = .....
    2. .....
    3. menu.exec_(event.globalPos())
    To copy to clipboard, switch view to plain text mode 
    Last edited by prashant; 9th October 2009 at 05:44.
    Prashant


    qt-sdk-win-opensource-2009.03.1.exe
    Python 2.6.3
    PyQt-Py2.6-gpl-4.6-1
    Win XP, 32 Bit

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: contextMenuEvent clashing

    Call the base class implementation of the method in the view.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. contextMenuEvent in QGraphicsItem
    By popai in forum Qt Programming
    Replies: 2
    Last Post: 17th August 2007, 09:13
  2. QTableView contextMenuEvent
    By derrickbj in forum Qt Programming
    Replies: 1
    Last Post: 1st March 2007, 16:37
  3. How to call contextMenuEvent on Qt::Key_F5?
    By rajesh in forum Qt Programming
    Replies: 5
    Last Post: 12th January 2007, 13:44
  4. QGraphicsView and contextMenuEvent
    By laurabee in forum Qt Programming
    Replies: 1
    Last Post: 12th October 2006, 22:22
  5. contextMenuEvent has issues since 4.1.3
    By momesana in forum Qt Programming
    Replies: 9
    Last Post: 31st May 2006, 17:27

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.