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. Embedding arbitrary window using createWindowContainer()
QtWS25 Last Chance

Embedding arbitrary window using createWindowContainer()

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 2.4k 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.
  • V Offline
    V Offline
    voidtrance
    wrote on last edited by mrjj
    #1

    Hi guys,

    I have an application, which used QX11EmbedContainer() to embed arbitrary windows (xterm, emacs, etc) into my application. This seemed to work pretty well.

    I am not now in the process of porting my application from Qt4 to Qt5 and I have found the new createWindowContainer() method of QWidget(). The problem is that I can't get things to work.

    Firstly, my understanding is that new method of embedding works differently. Rather than the external application embedding itself into the Qt window using the WinId of the Qt window, now the Qt Window pulls the external application into itself using the WinId of the external application. Is that correct?

    If my understanding described above is correct, how is Qt supposed to get the WinId of the external application? There doesn't seem to be a standard API to do this. Of course, all of this is easy of the external application is another Qt application. However, I am interested in embedding any arbitrary X11 application.

    [mrJJ- changed not -> now. ]

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      As far as I know via QWindow::fromWinId()
      But its not always happy
      https://bugreports.qt.io/browse/QTBUG-40320

      1 Reply Last reply
      0
      • V Offline
        V Offline
        voidtrance
        wrote on last edited by
        #3

        Yeah, I got that far, as well. However, the real question is how is the embedding application supposed to obtain the WinId of the external application?

        Searching through Google is showing me that there is no good way to do this. At the very least, there is no standard way to do it. The best that I've found is a shell script that is put together using xwininfo and xprop commands. Even then, those rely on a property (_NET_WM_PID) that may or may not be set by the external applications.

        Qt being a portable platform should have a portable way to get the WinId of an external application. Otherwise, this new embedding mechanism seems rather pointless and useless. The question is whether there really is a portable way to get the WinId and if so what is it?

        kshegunovK 1 Reply Last reply
        0
        • V voidtrance

          Yeah, I got that far, as well. However, the real question is how is the embedding application supposed to obtain the WinId of the external application?

          Searching through Google is showing me that there is no good way to do this. At the very least, there is no standard way to do it. The best that I've found is a shell script that is put together using xwininfo and xprop commands. Even then, those rely on a property (_NET_WM_PID) that may or may not be set by the external applications.

          Qt being a portable platform should have a portable way to get the WinId of an external application. Otherwise, this new embedding mechanism seems rather pointless and useless. The question is whether there really is a portable way to get the WinId and if so what is it?

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @voidtrance said in Embedding arbitrary window using createWindowContainer():

          Qt being a portable platform should have a portable way to get the WinId of an external application.

          Why? Is Qt a window manager? I don't think so.

          Otherwise, this new embedding mechanism seems rather pointless and useless.

          It's useful as an integration point between Qt and another library and/or code that creates/initializes/manages a window.

          The question is whether there really is a portable way to get the WinId and if so what is it?

          Refer to the OS/Library API you're working with, there should be some way provided it's designed well.

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          0
          • V Offline
            V Offline
            voidtrance
            wrote on last edited by
            #5

            @kshegunov said in Embedding arbitrary window using createWindowContainer():

            @voidtrance said in Embedding arbitrary window using createWindowContainer():

            Qt being a portable platform should have a portable way to get the WinId of an external application.

            Why? Is Qt a window manager? I don't think so.

            This has nothing to do with Qt being a window manager. I am not asking to mange windows. I am asking about querying the windowing system about window properties. Given that Qt applications are supposed to work in various windowing systems, it would stand to reason that it would have some kind of a standard, independent way to query properties from the windowing system.
            Otherwise, an application would have to implement the specifics of every windowing system that it may run under making it much less portable.

            Otherwise, this new embedding mechanism seems rather pointless and useless.

            It's useful as an integration point between Qt and another library and/or code that creates/initializes/manages a window.

            The question is whether there really is a portable way to get the WinId and if so what is it?

            Refer to the OS/Library API you're working with, there should be some way provided it's designed well.

            Sure, I can start making X11 calls but, again, the question was whether Qt provided a OS/Window manager independent way to do this. I am starting to think that there isn't.

            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