1
我有我的Qt/KDE應用此終端更改terminalinterface命令
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();
所以,在我的窗口,我看到了小部件是「終端」,但如何改變它的內部命令是什麼時候發生了定義的事件(顯然,當終端已經顯示時)?我試着:
terminalInterface->startProgram(QString::fromUtf8("/usr/bin/python"), QStringList() << "python");
,但它只能如果我做的最後一行之前:
QWidget* terminal = p->widget();
即代替 - > showShellInDir(一個QDir ::家()路徑(。 ));方法。
有幫助嗎?謝謝