20 QLineEdit* m_ptxtCommand;
21 QTextEdit* m_ptxtDisplay;
25 Shell(QWidget* pwgt = 0) : QWidget(pwgt)
27 m_process =
new QProcess(
this);
28 m_ptxtDisplay =
new QTextEdit;
30 QLabel* plbl =
new QLabel(
"&Command:");
33 QString strCommand =
"dir";
35 QString strCommand =
"ls";
38 m_ptxtCommand =
new QLineEdit(strCommand);
39 plbl->setBuddy(m_ptxtCommand);
41 QPushButton* pcmd =
new QPushButton(
"&Enter");
44 SIGNAL(readyReadStandardOutput()),
47 connect(m_ptxtCommand,
48 SIGNAL(returnPressed()),
54 QHBoxLayout* phbxLayout =
new QHBoxLayout;
55 phbxLayout->addWidget(plbl);
56 phbxLayout->addWidget(m_ptxtCommand);
57 phbxLayout->addWidget(pcmd);
59 QVBoxLayout* pvbxLayout =
new QVBoxLayout;
60 pvbxLayout->addWidget(m_ptxtDisplay);
61 pvbxLayout->addLayout(phbxLayout);
62 setLayout(pvbxLayout);
69 m_ptxtDisplay->append(m_process->readAllStandardOutput());
75 QString strCommand =
"";
77 strCommand =
"cmd /C ";
79 strCommand += m_ptxtCommand->text();
80 m_process->start(strCommand);