views:

382

answers:

1

Can one place an arbitrary program (firefox, openoffice, etc...) in a QX11EmbedContainer? The fllowing seems, to work

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QX11EmbedContainer container;
    container.show();

    QProcess * process = new QProcess(&container);
    QString executable("xterm");
    QStringList arguments;
    arguments << "-into";
    arguments << QString::number(container.winId());
    process->start(executable, arguments);

    int status = app.exec();
    process->close();
    return status;
}

but the next snippet launches a new window, not what I want

int main(int argc, char *argv[])
{
  QApplication app(argc, argv);

  QX11EmbedContainer container;
  container.show();

  QProcess * process = new QProcess(&container);
  QString executable("konsole");
  process->start(executable);

  int status = app.exec();
  process->close();
  return status;
}
+1  A: 

The first example work because xterm is able to reparent its top level widget (an X11 window). You tell it to do so with the argument -into <WinId>.

I don't know if Konsole can do that, i don't use it and the man page doesn't seem to talk about this.

But that doesn't mean it is not doable, the X Window system is very flexible and anyone can reparent another window (that's how windows managers add decorations to windows).

Take a look at man 3 XReparentWindow ;-)

p4bl0
It seems there's another solution here http://stackoverflow.com/questions/305523/embedding-an-application-in-this-case-a-terminal-within-a-qt-application#answer-310298
p4bl0