I would rather share the same instance of QProcess between the windows, how can I do that?
At first I tried to write to the process from control_window, but the UI crashed because the process wasn't initialized.
control window header:
#ifndef CONTROL_WINDOW_H
#define CONTROL_WINDOW_H
#include <QMainWindow>
#include <QProcess>
namespace Ui {
class control_window;
}
{
Q_OBJECT
public:
explicit control_window
(QWidget *parent
= 0);
~control_window();
private slots:
void on_control_window_Back_clicked();
private:
Ui::control_window *ui;
};
#endif // CONTROL_WINDOW_H
#ifndef CONTROL_WINDOW_H
#define CONTROL_WINDOW_H
#include <QMainWindow>
#include <QProcess>
namespace Ui {
class control_window;
}
class control_window : public QMainWindow
{
Q_OBJECT
public:
explicit control_window(QWidget *parent = 0);
~control_window();
private slots:
void on_control_window_Back_clicked();
private:
Ui::control_window *ui;
QProcess *m_opc_ua_server;
};
#endif // CONTROL_WINDOW_H
To copy to clipboard, switch view to plain text mode
control window source:
#include "control_window.h"
#include "configuration_window.h"
#include "ui_control_window.h"
control_window
::control_window(QWidget *parent
) : ui(new Ui::control_window)
{
ui->setupUi(this);
}
control_window::~control_window()
{
delete ui;
}
void control_window::on_control_window_Back_clicked()
{
m_opc_ua_server->write("j\n");
}
#include "control_window.h"
#include "configuration_window.h"
#include "ui_control_window.h"
control_window::control_window(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::control_window)
{
ui->setupUi(this);
}
control_window::~control_window()
{
delete ui;
}
void control_window::on_control_window_Back_clicked()
{
m_opc_ua_server->write("j\n");
}
To copy to clipboard, switch view to plain text mode
Besides how can I check the Process State? It enters this if regardless whether the process is running or not.
if (m_opc_ua_server->Running)
{
}
if (m_opc_ua_server->Running)
{
}
To copy to clipboard, switch view to plain text mode
Bookmarks