[Qt-interest] Problems with QX11Embed(Container|Widget)
Louai Al-Khanji
louai.khanji at gmail.com
Fri Jul 31 17:23:34 CEST 2009
Hi,
I'm having some trouble using the xembed widgets. For some reason the
client is never visible in the container.
I've simplified it to a very small test case below, am I doing
something wrong or is this a Qt bug? The container does become
visible, which seems to indicate that the client is embedded, but not
visible for some reason. Note that the client needs to be in the path.
When run, I do get the output one would expect:
> Will now run "client" ("4194306")
> Will embed into 4194306
All help appreciated. Here's the test case:
Container:
#include <QApplication>
#include <QX11EmbedContainer>
#include <QProcess>
#include <QDebug>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QX11EmbedContainer container;
QObject::connect(&container, SIGNAL(clientIsEmbedded()),
&container, SLOT(show()));
QString process = "client";
QStringList args;
args << QString::number(container.winId());
qDebug() << "Will now run" << process << args;
QProcess::startDetached(process, args);
return app.exec();
}
Client:
#include <QApplication>
#include <QX11EmbedWidget>
#include <QLabel>
#include <QHBoxLayout>
#include <QDebug>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
if (argc != 2) {
qDebug() << "Usage:" << argv[0] << "<wid>";
return 0;
}
WId id;
bool ok;
id = QString(argv[1]).toInt(&ok);
if (!ok) {
qDebug() << "Invalid window id";
}
qDebug() << "Will embed into" << id;
QX11EmbedWidget xembed;
QHBoxLayout lay;
QLabel label("HELLO");
lay.addWidget(&label);
xembed.setLayout(&lay);
xembed.embedInto(id);
return app.exec();
}
Thanks,
--
- Louai Al-Khanji
More information about the Qt-interest-old
mailing list