Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Want to pass a QDomDocument to an embedded Python script
Forum Updated to NodeBB v4.3 + New Features

Want to pass a QDomDocument to an embedded Python script

Scheduled Pinned Locked Moved Unsolved Qt for Python
8 Posts 3 Posters 440 Views 1 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.
  • kesterpmK Offline
    kesterpmK Offline
    kesterpm
    wrote on last edited by
    #1

    I'm trying to pass a QDomDocument to an embedded Python script. I believe I can use Py_BuildValue, but I can't find any good examples that show you how to pass your own object. Cany anyone point me to some good examples of this?

    jsulmJ 1 Reply Last reply
    0
    • kesterpmK kesterpm

      I'm trying to pass a QDomDocument to an embedded Python script. I believe I can use Py_BuildValue, but I can't find any good examples that show you how to pass your own object. Cany anyone point me to some good examples of this?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @kesterpm said in Want to pass a QDomDocument to an embedded Python script:

      embedded Python script

      In what way embedded? Is your app written in C++ and you're running a Python script inside your app?

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

      1 Reply Last reply
      0
      • kesterpmK Offline
        kesterpmK Offline
        kesterpm
        wrote on last edited by
        #3

        Yes, my C++ app will look for python scripts to load. Events are customizable and will call a Python method if it exists. Basically the app allows you to extend it's functionality using Python.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Are you planning to use PySide to manipulate your QDomDocument on the python side ?

          If so, this example might be a starting point.

          Hope it helps

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • kesterpmK Offline
            kesterpmK Offline
            kesterpm
            wrote on last edited by
            #5

            Yes, that code has been written and tested. The trick is passing this custom datatype between c++ and python. I could send a string over and import it into a qdomdocument, but that seems really inefficient.

            kesterpmK 1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Maybe the code injection part will offer some insight for your use case.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              kesterpmK 1 Reply Last reply
              0
              • kesterpmK kesterpm

                Yes, that code has been written and tested. The trick is passing this custom datatype between c++ and python. I could send a string over and import it into a qdomdocument, but that seems really inefficient.

                kesterpmK Offline
                kesterpmK Offline
                kesterpm
                wrote on last edited by
                #7
                This post is deleted!
                1 Reply Last reply
                0
                • SGaistS SGaist

                  Maybe the code injection part will offer some insight for your use case.

                  kesterpmK Offline
                  kesterpmK Offline
                  kesterpm
                  wrote on last edited by
                  #8

                  @SGaist Yeah it seems like you need to create a wrapper in C++ somehow. I would think a wrapper exists already, but I can't find any good examples. I'm pretty close to just sending it as a string to python, then converting it to a QDomDocument in the embedded python. Thanks for pointing me to those documents.

                  1 Reply Last reply
                  0

                  • Login

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