Hi All,

QT Version: 4.7.1
Platform: Linux Kubuntu 14
Compiler: c++11

After a long period of research on the web and forums, I successfully managed to use QX11EmbedContainer in order to embed a external application into a QT Widget.

The QT application holds a push button that is pressed by the user.
This is the general implemenation. How i get the window id is not of importance:

Qt Code:
  1. Demo::Demo() {
  2. QX11EmbedContainer *container = new QX11EmbedContainer(parent);
  3. layout->addWidget(container);
  4. }
  5.  
  6. WId Demo::getWinID() {
  7. //Implementation
  8. }
  9.  
  10. void Demo::runExternalApp() {
  11. //Implementation
  12. }
  13.  
  14. void Demo::on_runAppButton_clicked() {
  15. runExternalApp()
  16. container->embedClient(getWinID());
  17. }
To copy to clipboard, switch view to plain text mode 

After pressing the button, and the call to embedClient() the external application is successfully embedded exactly where I want it to, and its also functioning properly.
My problem starts when I try to close the external application regularly (from within my QT application) and then re-press the push button that embeds the external application (on_runAppButton_clicked()).
The external application is terminated properly when regularly exiting from it.
After pressing the push button again: the application is re-executed properly and embedded, but this time, it is embedded with a offset from the bottom of the layout that holds the container widget (QX11EmbedContainer widget).

Bare in mind the QT application keeps running throughout this process without terminating - The layout, container widget and parent widget aren't destroyed or anything like that.

Your help will be very helpful,
Thanks