Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs embedded in a Qt Application

Tags:

emacs

embed

qt

I've tried to embed emacs in a Qt Application using QX11EmbedContainer, and works but with two important exception. 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 thrown of the 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 if I try to write something in the minibuffer, the size of the widget is collapsed, and the focus is also lost:

other capture

If I make click in the (now shorter) widget, I can continue working with emacs without problems, but I should resize the window in order to emacs is expanded other time as originally.

Where is the problem?

like image 866
Peregring-lk Avatar asked Jul 31 '13 23:07

Peregring-lk


1 Answers

Try using a layout.

Here is the Qt5 documentation on layout management.

like image 79
Patrick Avatar answered Oct 25 '22 22:10

Patrick