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

后端 未结 2 1065
小蘑菇
小蘑菇 2021-02-09 18:20

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:

2条回答
  •  生来不讨喜
    2021-02-09 18:46

    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 
    #include 
    #include 
    #include 
    #include 
    

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

提交回复
热议问题