Hello,
I'm developing a UI that's controlling an external Program. In the Configuration Window, the process gets initialized and started, and I can write to it.
Configuration Window Header:
#ifndef CONFIGURATION_WINDOW_H
#define CONFIGURATION_WINDOW_H
#include <QWidget>
#include <QProcess>
class control_window;
namespace Ui {
class configuration_window;
}
class configuration_window
: public QWidget{
Q_OBJECT
friend class control_window;
public:
explicit configuration_window
(QWidget *parent
= 0);
~configuration_window();
private slots:
void on_configuration_window_Exit_clicked();
void on_configuration_window_Start_clicked();
private:
Ui::configuration_window *ui;
control_window *m_controlWindow;
};
#endif // CONFIGURATION_WINDOW_H
#ifndef CONFIGURATION_WINDOW_H
#define CONFIGURATION_WINDOW_H
#include <QWidget>
#include <QProcess>
class control_window;
class QProcess;
namespace Ui {
class configuration_window;
}
class configuration_window : public QWidget
{
Q_OBJECT
friend class control_window;
public:
explicit configuration_window(QWidget *parent = 0);
~configuration_window();
private slots:
void on_configuration_window_Exit_clicked();
void on_configuration_window_Start_clicked();
private:
Ui::configuration_window *ui;
control_window *m_controlWindow;
QProcess *m_opc_ua_server;
};
#endif // CONFIGURATION_WINDOW_H
To copy to clipboard, switch view to plain text mode
Configuration Window Source:
#include "configuration_window.h"
#include "ui_configuration_window.h"
#include "control_window.h"
#include <QMessageBox>
#include <QProcess>
#include <QDebug>
configuration_window
::configuration_window(QWidget *parent
) : ui(new Ui::configuration_window)
{
ui->setupUi(this);
m_controlWindow = new control_window();
}
configuration_window::~configuration_window()
{
delete ui;
}
void configuration_window::on_configuration_window_Exit_clicked()
{
}
void configuration_window::on_configuration_window_Start_clicked()
{
m_opc_ua_server->setProgram("test14/testprojekt.exe");
m_opc_ua_server
->start
(QIODevice::ReadWrite);
this->close();
m_controlWindow->show();
}
#include "configuration_window.h"
#include "ui_configuration_window.h"
#include "control_window.h"
#include <QMessageBox>
#include <QProcess>
#include <QDebug>
configuration_window::configuration_window(QWidget *parent) :
QWidget(parent),
ui(new Ui::configuration_window)
{
ui->setupUi(this);
m_opc_ua_server = new QProcess(this);
m_controlWindow = new control_window();
}
configuration_window::~configuration_window()
{
delete ui;
}
void configuration_window::on_configuration_window_Exit_clicked()
{
QApplication::quit();
}
void configuration_window::on_configuration_window_Start_clicked()
{
m_opc_ua_server->setProgram("test14/testprojekt.exe");
m_opc_ua_server->start(QIODevice::ReadWrite);
this->close();
m_controlWindow->show();
}
To copy to clipboard, switch view to plain text mode
In order to be able to write to it in the following windows, I have to initialize the Process. How can I do that?
If there are easier solutions to write to the Process, please tell me.
Bookmarks