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 embed external application in a scalable Qt window?

How to embed external application in a scalable Qt window?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 7.2k 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.
  • P Offline
    P Offline
    pmh4514
    wrote on last edited by
    #1

    I'm using Qt5.2 and for the purposes of this topic, we care about Windows only.

    I have a pre-existing Windows application which runs at a fixed 1280x1024 (it's that fixed side because it controls external hardware and has a completely "owner drawn" interface without any windows chrome)

    I now have a new Qt application that can launch this pre-existing app as a process. To do this I use QProcess::execute(..) and then QProcess::startDetached(..)

    That works fine to get the app open, at 1280x1024 externally, but I'm interested in finding a way to take the window of the spawned EXE and instead render it inside a Qt widget such that the whole 1280x1024 application will scale to display at whatever size the user makes the form (up to a max of 1280x1024). The "embedded" EXE process should continue to receive mouse-events so the user can still interact with it.

    I hope I've described this well. Is this possible with Qt?

    Thanks!

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thEClaw
      wrote on last edited by
      #2

      I think there is a way:
      You can embed windows/widgets with "QWidget::createWindowContainer":http://qt-project.org/doc/qt-5/qwidget.html#createWindowContainer . That's a static function that returns a QWidget - but it expects a QWindow*.

      "QWindow::fromWinId":http://qt-project.org/doc/qt-5/qwindow.html#fromWinId
      Now this function returns a QWindow* and only takes a platform-specific WinId, but you have to take care of two things: You have to obtain the WinId (maybe your QProcess can help, I don't know much about Windows internals), and, according to the documentation, a WinId can change during runtime, but as it says "here":http://qt-project.org/doc/qt-5/qwidget.html#winId you could probably counteract that.

      I think with some work and reading this should be possible. If you succeed or need more help, please say so. :)

      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