Add a pointer to the device-controller-plugin. The main window will always be

owned by the GUI thread, and the GUI thread is loading the plugin. Hence the
worker-thread does not block itself when inside a QT slot.
This commit is contained in:
2023-09-06 09:07:45 +02:00
parent c065b57f0c
commit 9531a08b4a
2 changed files with 8 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ QT_END_NAMESPACE
#include "worker.h"
class hwinf;
class MainWindow : public QMainWindow {
Q_OBJECT
@@ -18,13 +19,15 @@ protected:
void customEvent(QEvent *event) override;
public:
MainWindow(Worker *worker, QWidget *parent = nullptr);
MainWindow(hwinf *hw, Worker *worker, QWidget *parent = nullptr);
~MainWindow();
static const int START_PROGRESS_LOOP = -1;
static const int STOP_PROGRESS_LOOP = -2;
int progressValue() const { return m_progressValue; }
hwinf *getPlugin() { return m_hw; }
hwinf const *getPlugin() const { return m_hw; }
public slots:
void onAppendText(QString, QString suffix = "");
@@ -43,6 +46,7 @@ private:
void scrollDownTextEdit();
Ui::MainWindow *ui;
hwinf *m_hw;
Worker *m_worker;
int m_width;
QTimer *m_startTimer;