3

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;
}
adk
  • 4,479
  • 9
  • 36
  • 38

1 Answers1

3

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
  • 3,846
  • 1
  • 22
  • 21
  • 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 Jul 14 '09 at 11:35
  • What's the header file for this? I mean the embed container? I tried the normal #include and the error is that the file cannot be found. – praxmon Feb 03 '14 at 09:44