Changing terminalinterface command after showing it in qt / kdelibs application

I have this terminal in my qt / kde application

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

      

so the widget I see in my window is a "terminal", but how can I change its internal command when a certain event occurs (and obviously when the terminal is already displayed)? I've tried with:

terminalInterface->startProgram( QString::fromUtf8( "/usr/bin/python" ), QStringList() << "python");

      

but it only works if I do this to the last line:

QWidget* terminal = p->widget();

      

instead of instead of -> showShellInDir (QDir :: home (). path ()); Method.

Some help? Thanks to

+1


source to share


1 answer


Hola amigo! You can send any command to TerminalInterface prompt with

   terminalInterface->sendInput("/usr/bin/python\n"); 

      



Hope this is helpful: D

+1


source







All Articles