QX11EmbedWidget和QX11EmbedContainer [英] QX11EmbedWidget and QX11EmbedContainer

查看:513
本文介绍了QX11EmbedWidget和QX11EmbedContainer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在QX11EmbedContainer中放置任意程序(firefox,openoffice等)吗?看来工作很成功

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;
}

推荐答案

第一个示例有效,因为xterm能够重载其顶层窗口小部件(X11窗口).您可以使用参数-into <WinId>告诉它这样做.

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>.

我不知道Konsole是否可以做到这一点,我不使用它,手册页似乎也没有谈论这个.

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.

但这并不意味着它不可行,X Window系统非常灵活,任何人都可以重新创建另一个窗口(这是Windows管理器向窗口添加装饰的方式.)

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).

看看man 3 XReparentWindow;-)

这篇关于QX11EmbedWidget和QX11EmbedContainer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆