Results 1 to 5 of 5

Thread: I Can't enable DefaultContextMenu with ContextMenuEvent for my custom widget

  1. #1

    Default I Can't enable DefaultContextMenu with ContextMenuEvent for my custom widget

    I have a custom widget class which just draws a Rectangle of MaximumWidth and length of 30 pixels .Iwant to make it a DefaultcontextMenu.. and also I'm not able to implement the contextMenuEvent for this

    I'm very new to this could anyone send me a snippet code for this


    Thanks in Advance
    Naveen

  2. #2
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: I Can't enable DefaultContextMenu with ContextMenuEvent for my custom widget

    Which version of qt are you using.
    Can you show the code here. There is nothing stopping you from re-implementing contextMenuEvent.

  3. #3
    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: I Can't enable DefaultContextMenu with ContextMenuEvent for my custom widget

    Quote Originally Posted by Naveen
    I have a custom widget class which just draws a Rectangle of MaximumWidth and length of 30 pixels .Iwant to make it a DefaultcontextMenu.. and also I'm not able to implement the contextMenuEvent for this
    For default context menu the contextMenuEvent is not checked. Default context menu makes use of actions added to a widget (with addAction()). If you want to use contextMenuEvent, you have to switch context menu type to custom.

  4. #4
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: I Can't enable DefaultContextMenu with ContextMenuEvent for my custom widget

    Quote Originally Posted by Naveen
    .. and also I'm not able to implement the contextMenuEvent for this
    I thought this implies that he is unable to compile the code.

  5. #5
    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: I Can't enable DefaultContextMenu with ContextMenuEvent for my custom widget

    Sorry, looks like I was wrong here. Default context menu policy is to use contextMenuEvent and not a list of QActions.

    So, based on that... can we see the code of contextMenuEvent?

Similar Threads

  1. Custom Widget - First Steps
    By sekatsim in forum Qt Programming
    Replies: 8
    Last Post: 26th June 2008, 17:19
  2. Custom widget
    By zorro68 in forum Qt Programming
    Replies: 7
    Last Post: 28th January 2008, 14:06
  3. custom plug-in widget in another custom plug-in widget.
    By MrGarbage in forum Qt Programming
    Replies: 6
    Last Post: 27th August 2007, 15:38
  4. Simple custom widget won't size properly
    By MrGarbage in forum Qt Tools
    Replies: 2
    Last Post: 9th August 2007, 13:12
  5. Custom tab widget question
    By PrimeCP in forum Qt Programming
    Replies: 2
    Last Post: 7th August 2007, 11:17

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.