C++ (Qt)QObject *parent; ... QString program = "./path/to/Qt/examples/widgets/analogclock"; QStringList arguments; arguments << "-style" << "motif"; QProcess *myProcess = new QProcess(parent); myProcess->start(program, arguments);
C++ (Qt)#ifndef USBCONTROLLER_H#define USBCONTROLLER_H#include <QDialog>#include "ui_usbController.h" class usbController : public QDialog, public Ui::usbController{ Q_OBJECTpublic: usbController(QWidget *parent = 0);private slots: void on_lineEdit_1_textChanged();};#endif // USBCONTROLLER_H
C++ (Qt)#include <QtGui>#include "usbcontroller.h" usbController::usbController(QWidget *parent) : QDialog(parent){ setupUi(this); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); }void usbController::on_lineEdit_1_textChanged(){buttonBox->button(QDialogButtonBox::Ok)->setEnabled(lineEdit_1->hasAcceptableInput());}
C++ (Qt)#include <QApplication>#include <usbcontroller.h> int main(int argc, char *argv[]){ QApplication app(argc, argv); usbController *dialog = new usbController; dialog->show(); return app.exec();}