Hi everybody,

I would like to know the best way to control/modify elements of my MainWindow class from a QThread class started from the mainwindow.
In particular I only want to append text to the textEdit on the mainwindow and modify the progress bar value, during the QThread calculation.

I tried the heritage method but it doesn't works.

Ex. of my app:
Qt Code:
  1. #ifndef HRSMAINWINDOW_H
  2. #define HRSMAINWINDOW_H
  3.  
  4. #include <QtGui/QMainWindow>
  5.  
  6. namespace Ui
  7. {
  8. class HRSMainWindowForm;
  9. }
  10.  
  11. class HRSMainWindow : public QMainWindow
  12. {
  13. Q_OBJECT
  14.  
  15. public:
  16. HRSMainWindow(QWidget *parent = 0);
  17. ~HRSMainWindow();
  18. void APT(QString a){ //append text to the textEdit
  19. ui->textEdit->append(a);
  20. }
  21.  
  22. private:
  23. Ui::HRSMainWindowForm *ui;
  24. };
  25.  
  26. #endif // HRSMAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #ifndef HRSTHREAD_H
  2. #define HRSTHREAD_H
  3.  
  4. #include <QThread>
  5. #include "hrsmainwindow.h"
  6.  
  7. class HRSThread : public QThread, public HRSMainWindow
  8. {
  9. public:
  10. void run(){
  11. APT("Hello World"); // don`t work
  12. }
  13. };
  14.  
  15. #endif // HRSTHREAD_H
To copy to clipboard, switch view to plain text mode 

Thank you very much