tags:

views:

62

answers:

1

I have this terminal on 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 "terminal", but how can I change its inner command when a defined event happens (and, obviously, when the terminal is already displayed)? I've tried with:

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

but it works only if I do it before the last line:

QWidget* terminal = p->widget();

viz instead of the ->showShellInDir(QDir::home().path()); method.

Some help? Thanks

+1  A: 

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

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

I hope it's will be useful :D

Emilio