Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. [Solved] QWebPage::WebAction add own Action to context menu

[Solved] QWebPage::WebAction add own Action to context menu

Scheduled Pinned Locked Moved Qt WebKit
4 Posts 2 Posters 4.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AcerExtensa
    wrote on 25 Aug 2011, 13:15 last edited by
    #1

    Hallo everyone,
    does anybody know how do I add custom QAction to Standart QWebPage context menu or change attributes of standard one?

    I actually need to disable "Go Back" and "Reload" actions. + Enable/or add my own "Sellect All"(and reconnect it to my own slot, because of buggy behavior of standard action if enabled with setContentEditable(true))....

    @
    QWebView view = new QWebView();
    // This gives Segnebtation fault
    QAction test = view->page()->action(QWebPage::SelectAll)->menu()->addAction("Sellect All");

    //this does nothing at all
    QAction test = view->page()->action(QWebPage::SelectAll);
    test->setEnabled(true);
    test->setVisible(true);

    connect( .... etc...
    @

    God is Real unless explicitly declared as Integer.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on 25 Aug 2011, 14:09 last edited by
      #2

      Just override QWebView::contextMenuEvent. In there, you can check if the menu is swallowed by the QWebPage (swallowContextMenuEvent), get the default one from the page (QWebPage::createStandardContextMenu), modify it, and/or exec the one you want.

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AcerExtensa
        wrote on 25 Aug 2011, 14:28 last edited by
        #3

        Thank you, peppe!
        I will try that...

        God is Real unless explicitly declared as Integer.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AcerExtensa
          wrote on 26 Aug 2011, 07:40 last edited by
          #4

          Wroks perfect! Thanks!

          God is Real unless explicitly declared as Integer.

          1 Reply Last reply
          0

          1/4

          25 Aug 2011, 13:15

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved