title: How to solve: QPixmap: It is not safe to use pixmaps outside the GUI thread
body: <p>I'm trying to display a sequence of images coming at 30 image per second in <code>qt label</code> but I'm getting that error of GUI thread. I did little bit research and I read that it is recommended using <code>QImage</code> instead but I'm not sure how to do it in my case.
  Here's a shot of my classes and the method I'm using to get the frames:</p>
  
  <p><strong><em>main_window.hpp</em></strong></p>
  
  <pre><code>class MainWindow : public QMainWindow {
  Q_OBJECT
  
  public:
      MainWindow(int argc, char** argv, QWidget *parent = 0);
      ~MainWindow();
  
  public Q_SLOTS:
      void callBackColor(const sensor_msgs::ImageConstPtr&amp; msg);
  
  private:
      Ui::MainWindowDesign ui;
      ros::Subscriber sub;
  };
  </code></pre>
  
  <p><strong><em>main_window.cpp</em></strong></p>
  
  <pre><code>MainWindow::MainWindow(int argc, char** argv, QWidget *parent)
      : QMainWindow(parent)
  {
      ui.setupUi(this);
  
      ros::init(argc,argv,"MainWindow");
      ros::NodeHandle n;
      sub = n.subscribe("/usb_cam/image_raw", 1, &amp;MainWindow::callBackColor, this);
  }
  
  void MainWindow::callBackColor(const sensor_msgs::ImageConstPtr&amp; msg)
  {
  
    cv_bridge::CvImagePtr cv_ptr;
  
    try
    {
      cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8);
    }
  
    catch (cv_bridge::Exception&amp; e)
    {
      ROS_ERROR("cv_bridge exception: %s", e.what());
      return;
    }
    //Here I got the image and I want to display it in a label
    QImage temp(&amp;(msg-&gt;data[0]), msg-&gt;width, msg-&gt;height, 
    QImage::Format_RGB888);
    static QLabel *imageLabel = new QLabel;
    QPixmap pix = QPixmap::fromImage(temp);
    ui.imageLabel-&gt;setPixmap(pix);
  }
  </code></pre>
  
  <p>Do you have any idea how to solve this?</p>