Results 1 to 4 of 4

Thread: Disable context menu in QWebView

  1. #1
    Join Date
    Feb 2008
    Posts
    16
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Disable context menu in QWebView

    I use QWebView component and I need use custom menu or disable context meny (menu with review link downloadn image, reload page and other).

    I find function
    bool swallowContextMenuEvent ( QContextMenuEvent * event )
    but I not know how.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Disable context menu in QWebView

    QWebView is inherited from QWidget.
    So you can override QWidget::contextMenuEvent and do what you want.

  3. #3
    Join Date
    Feb 2008
    Posts
    16
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Disable context menu in QWebView

    I know this. its works.
    But I ask about disable context menu with use only QWebView methots.
    but if this impossible np.
    Because I create class based on QWebView and redeclare contextMenuEvent ( QContextMenuEvent * event )

    and all works fine.



    Thanks.

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Disable context menu in QWebView

    In that case QWidget::setContextMenuPolicy() might be of some help to you.
    You can try setting it to Qt::NoContextMenu and see what happens

Similar Threads

  1. Context Menu on QTableWidget
    By ankurjain in forum Qt Programming
    Replies: 9
    Last Post: 17th December 2009, 10:52
  2. QTable context menu
    By grabnerj in forum Qt Programming
    Replies: 1
    Last Post: 24th June 2008, 06:20
  3. context menu problem
    By dreamer in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2008, 14:18
  4. Replies: 4
    Last Post: 25th June 2007, 21:40
  5. QTreeWidget Context Menu
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 11th May 2007, 12:24

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.