Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Compose pointer to property of object
Forum Updated to NodeBB v4.3 + New Features

Compose pointer to property of object

Scheduled Pinned Locked Moved Solved General and Desktop
c++pointerobjectsproperties
25 Posts 3 Posters 8.9k Views 2 Watching
  • 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.
  • J jsulm
    5 Apr 2016, 15:47

    You're most probably dereferencing a null pointer. Signal 11 means SIGSEGV (segmentation error).

    M Offline
    M Offline
    McLion
    wrote on 6 Apr 2016, 08:21 last edited by
    #21

    @jsulm
    Yes - Thanks . Problem loacted, but not yet solved:

    void QTGUI_MainWindow::populateJavaScriptWindowObject()
    {
      QWebView * webGUI = qobject_cast<QWebView *>(sender());
      webGUI->page()->mainFrame()->addToJavaScriptWindowObject("NativeBridge", this);
    }
    

    The sender is the JS and not the QWebView and so I do not get the pointer to the QWebView that I need. Instead, the pointer is 0x0 and then - of course - the addToJ... crashes.

    Any idea how I get the pointer to the QWebView from which the JS is sending?
    Thanks

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 6 Apr 2016, 08:42 last edited by
      #22

      What is JS?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply 6 Apr 2016, 08:45
      0
      • J jsulm
        6 Apr 2016, 08:42

        What is JS?

        M Offline
        M Offline
        McLion
        wrote on 6 Apr 2016, 08:45 last edited by
        #23

        @jsulm
        JavaScript (in/from QWebKit ... more precise page()->mainFrame().

        1 Reply Last reply
        0
        • M Offline
          M Offline
          McLion
          wrote on 6 Apr 2016, 11:33 last edited by
          #24

          I posted this as a separate question in the WebKit group.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            McLion
            wrote on 6 Apr 2016, 14:57 last edited by
            #25

            Got it solved :-)

            QWebFrame * webGUIframe = qobject_cast<QWebFrame >(sender());
            QWebView * webGUI = (QWebView
            )(webGUIframe->parent())->parent();
            webGUI->page()->mainFrame()->addToJavaScriptWindowObject("NativeBridge", this);

            1 Reply Last reply
            0

            21/25

            6 Apr 2016, 08:21

            • Login

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