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. Making Qt-Application dynamic by runtime interpretation?
Forum Update on Monday, May 27th 2025

Making Qt-Application dynamic by runtime interpretation?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 801 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.
  • NiagarerN Offline
    NiagarerN Offline
    Niagarer
    wrote on last edited by Niagarer
    #1

    Hi! (spoiler: I am not a professional programmer ;) )
    I have a little problem:
    In my Qt-application, I want to be able to import widgets, I created in another program and show them.
    But changing the widget, should change some properties of objects in my program. The problem here is, that the main application shall not know, what widget it will get to be able to import any kind of widget at runtime for full unlimitation.
    From my experience, this is not possible in C++, unless the main program knows, what different widgets it could get. But I want to be able to create to create any widget.
    Rewriting the programs in Python seems to be the only option with Qt so far, since Python is runtime interpreted and does not need to know, what widgets it will get because of that. But when I take a look into the list of implemented (and documented!) classes in PySide2, I don't think, I can create a QGraphicsView with a QGraphicsScene, containing QGraphicsItems and all other stuff, I use in the main program in Python just as I did in C++.

    First question: with which assumptions am I right, which are wrong?
    Second: Have you any Idea, how I could implement that?

    Please tell me, what information is missing for a senceful answer, I will edit the question.
    And the performance is not a major factor. The program is not that complex, that a Python-implementation would slow it down drastically (I guess).

    Thank you for answers!

    Pablo J. RoginaP JKSHJ 2 Replies Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Hi, as a general rule, if C++ can't do it, then you need to move to a lower, not higher level of programming.
      Python uses text files interpreted by a program and guess what language that program is written in?! C

      So I don't think what you are trying to do is possible unless you implement some serious hacks

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      0
      • NiagarerN Niagarer

        Hi! (spoiler: I am not a professional programmer ;) )
        I have a little problem:
        In my Qt-application, I want to be able to import widgets, I created in another program and show them.
        But changing the widget, should change some properties of objects in my program. The problem here is, that the main application shall not know, what widget it will get to be able to import any kind of widget at runtime for full unlimitation.
        From my experience, this is not possible in C++, unless the main program knows, what different widgets it could get. But I want to be able to create to create any widget.
        Rewriting the programs in Python seems to be the only option with Qt so far, since Python is runtime interpreted and does not need to know, what widgets it will get because of that. But when I take a look into the list of implemented (and documented!) classes in PySide2, I don't think, I can create a QGraphicsView with a QGraphicsScene, containing QGraphicsItems and all other stuff, I use in the main program in Python just as I did in C++.

        First question: with which assumptions am I right, which are wrong?
        Second: Have you any Idea, how I could implement that?

        Please tell me, what information is missing for a senceful answer, I will edit the question.
        And the performance is not a major factor. The program is not that complex, that a Python-implementation would slow it down drastically (I guess).

        Thank you for answers!

        Pablo J. RoginaP Offline
        Pablo J. RoginaP Offline
        Pablo J. Rogina
        wrote on last edited by
        #3

        @Niagarer said in Making Qt-Application dynamic by runtime interpretation?:

        import any kind of widget at runtime for full unlimitation.

        Is it QUiLoader what you're looking for?

        The QUiLoader class enables standalone applications to dynamically create user interfaces at run-time using the information stored in UI files or specified in plugin paths

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        NiagarerN 1 Reply Last reply
        0
        • Pablo J. RoginaP Pablo J. Rogina

          @Niagarer said in Making Qt-Application dynamic by runtime interpretation?:

          import any kind of widget at runtime for full unlimitation.

          Is it QUiLoader what you're looking for?

          The QUiLoader class enables standalone applications to dynamically create user interfaces at run-time using the information stored in UI files or specified in plugin paths

          NiagarerN Offline
          NiagarerN Offline
          Niagarer
          wrote on last edited by Niagarer
          #4

          @VRonin said in Making Qt-Application dynamic by runtime interpretation?:

          So I don't think what you are trying to do is possible unless you implement some serious hacks

          :,(

          Hi, as a general rule, if C++ can't do it, then you need to move to a lower, not higher level of programming.

          Well, makes sence but I am confused anyway. If Python is runtime interpreted and can take and evaluate any command I give it (over the command line) at any time at runtime, why can't it take Widget, evaluate it and show it on the screen at runtime?

          @Pablo-J.-Rogina
          Well, thank you, this sounds very interesting!
          But I think, there is no way to evaluate the widgets' content here at runtime, right (f.ex. calling a function/slow in my program after changed something specific in the widget)? Because the importing program does not know, what it will get at compiletime.

          1 Reply Last reply
          0
          • NiagarerN Niagarer

            Hi! (spoiler: I am not a professional programmer ;) )
            I have a little problem:
            In my Qt-application, I want to be able to import widgets, I created in another program and show them.
            But changing the widget, should change some properties of objects in my program. The problem here is, that the main application shall not know, what widget it will get to be able to import any kind of widget at runtime for full unlimitation.
            From my experience, this is not possible in C++, unless the main program knows, what different widgets it could get. But I want to be able to create to create any widget.
            Rewriting the programs in Python seems to be the only option with Qt so far, since Python is runtime interpreted and does not need to know, what widgets it will get because of that. But when I take a look into the list of implemented (and documented!) classes in PySide2, I don't think, I can create a QGraphicsView with a QGraphicsScene, containing QGraphicsItems and all other stuff, I use in the main program in Python just as I did in C++.

            First question: with which assumptions am I right, which are wrong?
            Second: Have you any Idea, how I could implement that?

            Please tell me, what information is missing for a senceful answer, I will edit the question.
            And the performance is not a major factor. The program is not that complex, that a Python-implementation would slow it down drastically (I guess).

            Thank you for answers!

            JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by JKSH
            #5

            @Niagarer said in Making Qt-Application dynamic by runtime interpretation?:

            From my experience, this is not possible in C++, unless the main program knows, what different widgets it could get.

            Correct.

            Rewriting the programs in Python seems to be the only option with Qt so far

            It's not the only option (for example, you could use QML + JavaScript too), but it's a feasible option.

            when I take a look into the list of implemented (and documented!) classes in PySide2, I don't think, I can create a QGraphicsView with a QGraphicsScene, containing QGraphicsItems and all other stuff, I use in the main program in Python just as I did in C++.

            Those are definitely documented: https://doc.qt.io/qtforpython/PySide2/QtWidgets/QGraphicsView.html

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            2

            • Login

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