PDA

View Full Version : QX11EmbedContainer Problems



GuS
24th June 2008, 14:20
Hi guys!

I have a little problem... In my application i was embedding a xterm console using QX11EmbedContainer. But since Qt4.4 this does not work (was working perfectly before:

Heres the code (in PyQt, sorry...):




class toolsConsole(QtCore.QObject):
def __init__(self, gui):
QtCore.QObject.__init__(self)

self.gui = gui

# Creamos un contenedor para poder embeber la consola dentro de un frame
self.container = QX11EmbedContainer(self.gui.consoleFrame)
self.container.setGeometry(4, 4, 600, 425)

# Comenzamos a definir la ventana para poder obtener el wid (window ID) y colocarlo en el "container"
wid = self.container.winId()

# Asigamos los parámetros de la aplicación y a su vez, obtenemos el número de WID.
self.parametersList = ["-into", repr(wid), "-bg", "black", "-fg", "white"]

# Definimos la clase para ejecutar el proceso, o sea, la aplicación de la consola xterm
self.process = QtCore.QProcess()

# Especificamos que el path por defecto, sea el HOME de cada usuario.
self.initDirectory = QString(QDir.homePath())
self.process.setWorkingDirectory(self.initDirector y)

# Ejecutamos el proceso de xterm
self.process.start("xterm", self.parametersList)


Any Tip?

Thanks!!

caduel
24th June 2008, 15:09
What is the specific problem that you have now (i.e. please be more specific as to what "does not work" means)?

Did you check that "wid" has a meaningful value?
Perhaps you need to call
self.container.show before grabbing the winId / before starting your process?

Embedding basically works in Qt4.4 (just gave it a try with

#include <QtGui>
#include <QX11EmbedContainer>

int main(int argc, char **argv)
{
QApplication app(argc,argv);
QX11EmbedContainer c;
c.show();
qDebug() << c.winId();
return app.exec();
}
in a shell I entered:
xterm -into <id that was output by Qt>
which produced an xterm was inside the Qt window.

HTH

GuS
24th June 2008, 17:28
Yeah sorry.. I meant that the xterm console was not
Embedding. And this exactly code was working on Qt4.3 and older. Since Qt4.4 this does not work for me.

Using self.container.show does nothing either.

I will continue digging this...

NOTE: i was looking that i have not xterm process running :S
Maybe is there a problem catching the winId...