Emacs is embedded in the Qt application

I tried embedding emacs in a Qt application using the QX11EmbedContainer and it works, but with two important exceptions. First of all, here is the code:

 #include <QX11EmbedWidget> #include <QtGui> #include <QApplication> int main(int argc, char *argv[]) { QApplication app(argc, argv); QX11EmbedContainer container; container.show(); container.resize(500, 500); QProcess* process = new QProcess(&container); QString executable("emacsclient"); QStringList arguments; arguments << "--parent-id" << QString::number(container.winId()); process->start(executable, arguments); int status = app.exec(); process->close(); return status; } 

And the compilation and execution line (and the previous version of emacs server):

 $ emacs -q --daemon & // filtered output $ g++ test.cpp -lQtGui -lQtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 $ ./a.out 

And finally, the result:

Emacs client embedded in Qt

But when or when I try to write something in the minibuffer, the size of the widget collapses, and the focus is also lost:

other capture

If I click on (now shorter) widgets, I can work with emacs without problems, but I have to resize the window so that emacs expands at a different time, as originally.

Where is the problem?

+7
qt emacs embed
source share
1 answer

Try using a layout.

Here is the Qt5 layout management documentation.

+5
source share

All Articles