How to resize XEmbed in Qt5 with window size change
-
Hi,
I'm trying to resize external application which is attached to application usingQWidget::createWindowContainer
for simplicity in examplexterm
is used:#include <QApplication> #include <QWidget> #include <QVBoxLayout> #include <QWindow> #include <QProcess> int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget widget; QWindow window; QWidget *container = QWidget::createWindowContainer(&window, &widget); QVBoxLayout layout; QProcess process; QStringList arguments; layout.addWidget(container); widget.setLayout(&layout); widget.show(); arguments << "-into" << QString::number(container->winId()); // also doesn't work properly with window.winId() process.start("xterm", arguments); return app.exec(); }
And in this example
xterm
is not resized when main widget is resized, following example works in Qt4 withQX11EmbedContainer
:#include <QApplication> #include <QWidget> #include <QX11EmbedContainer> #include <QVBoxLayout> #include <QProcess> int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget widget; QX11EmbedContainer container(&widget); QVBoxLayout layout; QProcess process; QStringList arguments; layout.addWidget(&container); widget.setLayout(&layout); widget.show(); arguments << "-into" << QString::number(container.winId()); process.start("xterm", arguments); return app.exec(); }
Does anybody have idea how I can achieve such effect in Qt5 like in Qt4 with
QX11EmbedContainer
? Any tips will be very helpful. -
It looks that solution in
GTK
is quite simple, it's sad thatQt5
hasn't nothing to offer like it was inQt4
withQX11EmbedContainer
...Simple example in
GTK3
usingpython
:import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk from subprocess import Popen window = Gtk.Window(title="Xterm embed") socket = Gtk.Socket() window.add(socket) sock_id = str(socket.get_id()) # sendEvents required according to xterm documentation cmd = ["xterm", '-xrm', "xterm*.allowSendEvents: true", "-into", sock_id] Popen(cmd) socket.show() window.show() window.connect("destroy", Gtk.main_quit) Gtk.main()
-
Hi
Did you try
https://github.com/lukas-w/qt5-x11embed -
@mrjj I didn't recieve any message about your response, and I saw it when I tried to find solution of this problem once again after while :P
I already saw this repository but I didn't used because I would like to find solution without compiling additional plugins also repository looks like not developed anymore.