You cannot directly change something in the GUI thread from a different thread. The reason you are getting a segfault is probably because the GUI thread and your "Thread" are not synchronized.

The correct way to do it is to emit a signal from your Thread that is connected to a slot in MainWindow.

Qt Code:
  1. class MainWindow : public QMainWindow
  2. {
  3. // ...
  4. private slots:
  5. void onChangeLabel( int mode );
  6.  
  7. private:
  8. QLabel * m_label;
  9. };
  10.  
  11. class Thread : public QThread
  12. {
  13. // ...
  14. signals:
  15. void changeLabel(int mode );
  16. };
  17.  
  18. MainWindow::MainWindow( QWidget * parent )
  19. : Qwidget( parent )
  20. {
  21. // ...
  22. connect( m_mainwindowThread, &Thread::changeLabel, this, &MainWindow::onChangeLabel );
  23. }
  24.  
  25. void Thread::afficheLabelArret()
  26. {
  27. if (m_threadGainable.labelModeFroid == true) {
  28. emit changeLabel( 0 );
  29. else if (m_threadGainable.labelModeChauffage == true) {
  30. emit changeLabel( 1 );
  31. } else {
  32. emit changeLabel( 2 );
  33. }
  34.  
  35. void MainWindow::onChangeLabel( int mode )
  36. {
  37. switch( mode )
  38. {
  39. case 0:
  40. m_label ->setPixmap(QPixmap("/home/ludo/Qt/test2/build/images/froid.jpg"));
  41. break;
  42.  
  43. case 1:
  44. m_label ->setPixmap(QPixmap("/home/ludo/Qt/test2/build/images/chauffage.jpg"));
  45. break;
  46.  
  47. default:
  48. m_label ->setPixmap(QPixmap("/home/ludo/Qt/test2/build/images/abigael.jpg"));
  49. break;
  50. }
  51. }
To copy to clipboard, switch view to plain text mode 

The signal / slot mechanism will make sure that the inter-thread call is synchronized correctly.