Hi all,
I'm really new of QT programming and I need to acess my ui pointer from a thread to refresh an image that's displayed in my window.
How can i do this? Many thanks to everyone who will help me
Gian

I post some code to explain it better:

MainWindow.h:
Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QtGui/QMainWindow>
  5.  
  6. namespace Ui
  7. {
  8. class MainWindow;
  9. }
  10.  
  11. class MainWindow : public QMainWindow
  12. {
  13. Q_OBJECT
  14.  
  15. public:
  16. MainWindow(QWidget *parent = 0);
  17. ~MainWindow();
  18.  
  19. private:
  20. Ui::MainWindow *ui;
  21. };
  22.  
  23. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

MainWindow.cpp:
Qt Code:
  1. MainWindow::MainWindow(QWidget *parent)
  2. : QMainWindow(parent), ui(new Ui::MainWindow)
  3. {
  4. ui->setupUi(this);
  5. MyThread* myT = new MyThread();
  6. myT->run();
  7. }
To copy to clipboard, switch view to plain text mode 

getFrameThread.cpp:
Qt Code:
  1. void MyThread::run()
  2. {
  3. forever {
  4. //MainWindow *ui = MainWindow::ui;
  5. CvCapture* camera;
  6. camera = cvCreateCameraCapture(0);
  7. assert(camera);
  8. IplImage * cvimage=cvQueryFrame(camera);
  9. assert(cvimage);
  10. // IMG ELABORATION SKIPPED
  11. MainWindow::ui->imgLabel->setPixmap(CVUtils::getImage(cvimage)); // This is the row i want to fix
  12. }
  13. }
To copy to clipboard, switch view to plain text mode 

getFrameThread.h:
Qt Code:
  1. #include "CVUtils.h"
  2. #include <QThread>
  3.  
  4. class MyThread : public QThread
  5. {
  6. Q_OBJECT
  7. public:
  8. MyThread();
  9.  
  10. public:
  11. void run();
  12. MainWindow* ui;
  13. };
To copy to clipboard, switch view to plain text mode