Search code examples
linuxqtx11kde-plasmaxterm

embedding an application (in this case a terminal) within a QT application


I am writing a QT application and I need to embed a terminal (we say,xterm) within a QDialog, like some KDE application (see kdevelop/kate/...).

I've been trying with: - QX11EmbedContainer placed into the QLayout of my QDialog - QProcess for the program I want to excecute

I expect the QProcess running within the QX11EmbedContainer, but it does not work.

The problem is that I can't put the xterm into the QX11EmbedContainer, the only thing I obtain is an xterm window (unfortunately separated from my QDialog). Does anybody got the same problem?


Solution

  • Sorry, I've tried your solution before posting oh this site and it does not work. I've solved switching to kdelibs and using those imports and this code

    #include <kparts/part.h>
    #include <assert.h>
    #include <kde_terminal_interface.h>
    #include <kpluginfactory.h>
    #include <klibloader.h>
    

    KLibFactory* factory = KLibLoader::self()->factory( "libkonsolepart" );
    KParts::Part* p = static_cast<KParts::Part*>(factory->create( this,"tralala",         
    QStringList() << "dio") );
    
    assert(p);
    setCentralWidget( p->widget() );
    TerminalInterface *t = qobject_cast<TerminalInterface*>(p);
    t->showShellInDir( QDir::home().path() );