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. How to clone QJSEngine?
QtWS25 Last Chance

How to clone QJSEngine?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qjsengine
5 Posts 3 Posters 422 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.
  • M Offline
    M Offline
    Merssedes
    wrote on last edited by
    #1

    Given the instance of QJSEngine, how to create new instance with the same state?

    C 1 Reply Last reply
    0
    • M Merssedes

      Given the instance of QJSEngine, how to create new instance with the same state?

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      @Merssedes I am not a QJSEngine user, but you cannot clone a QObject (by design). You would have to create a new object and manually configure it to match. I do not see a simple way to achieve this.

      M 1 Reply Last reply
      3
      • C ChrisW67

        @Merssedes I am not a QJSEngine user, but you cannot clone a QObject (by design). You would have to create a new object and manually configure it to match. I do not see a simple way to achieve this.

        M Offline
        M Offline
        Merssedes
        wrote on last edited by
        #3

        @ChrisW67 you mean if library accepts instance of QJSEngine, it can't create more of them? Cna you link me to any discussions related to this design choise?

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

          You can create several instances but you cannot copy them. Though AFAIK, there's usually no reason to have more than one. What is 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

          M 1 Reply Last reply
          1
          • SGaistS SGaist

            You can create several instances but you cannot copy them. Though AFAIK, there's usually no reason to have more than one. What is your use case ?

            M Offline
            M Offline
            Merssedes
            wrote on last edited by
            #5

            @SGaist Multithreading with requirement of no interlocking. Because QJSEngine is not thread safe, the only way I see for now is to clone original prepared instance for each worker thread. Anything else requires syncronisation between threads, which means interlocking.

            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