Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with successive attempts to embed external app in QT Widget
Qt 6.12 LTS is out! See what's new in the release blog

Problem with successive attempts to embed external app in QT Widget

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 2 Posters 2.0k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    Did you ensure that the layout is empty after removing that embedded application ?

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

    W 1 Reply Last reply
    0
    • SGaistS SGaist

      Hi,

      Did you ensure that the layout is empty after removing that embedded application ?

      W Offline
      W Offline
      walle19
      wrote on last edited by walle19
      #3

      @SGaist thanks for the reply,
      Is there a programmatic way to check if the layout is empty?

      I used: layout->count() but oddly, the number of items before and after calling
      layout->addWidget() is 0.

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

        Do you have any stretch added ?

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

        W 1 Reply Last reply
        0
        • SGaistS SGaist

          Do you have any stretch added ?

          W Offline
          W Offline
          walle19
          wrote on last edited by
          #5

          @SGaist no, the QX11EmbedContainer object's parent is a QWidget and its size policy is [Preffered, Preffered].
          Regarding the QX11EmbedContainer itself I didn't explicitly define any stretching.

          1 Reply Last reply
          0
          • W Offline
            W Offline
            walle19
            wrote on last edited by
            #6

            Interesting fact:
            I now noticed that after the second execution of the external application and embedding, and seeing that the embedded app is offset from bottom of layout as mentioned,
            If I double click the GUI of the qt app in order to minimize the whole window ("restore down") and then maximizing it, the external app suddenly fits in place.
            Is there some sort of refresh method i need to invoke ?

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

              Does it also happen on resize ?

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

              W 1 Reply Last reply
              0
              • SGaistS SGaist

                Does it also happen on resize ?

                W Offline
                W Offline
                walle19
                wrote on last edited by
                #8

                @SGaist if i understood the question correctly, then when resizing the qt gui main window the embedded external app doesn't get offset. It behaves properly.
                The offset is introduced only on the second attempt to embed it.

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

                  Sorry, I meant: after the second embedding, if you resize the container widget, does it also fix the positioning issue ?

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

                  W 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Sorry, I meant: after the second embedding, if you resize the container widget, does it also fix the positioning issue ?

                    W Offline
                    W Offline
                    walle19
                    wrote on last edited by
                    #10

                    @SGaist It seems it did. This is very interesting.
                    I called the containers resize() method right after the embedClient().
                    The remote application didn't actually change size to what i specified in resize() and stills fits as intended to it's dedicated layout.
                    After the second execution of external app again the resize() and embedClient() are called but now the offset has disappeared.
                    Any conclusion ?

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

                      @walle19 said in Problem with successive attempts to embed external app in QT Widget:

                      Any conclusion ?

                      Embedding is tricky ! But also, you are using a version of Qt that is way more than outdated. If locked to Qt 4, you should check with the latest release of that series which is 4.8.7.

                      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

                      • Login

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