Hi,

I'm a new Qt user and I try to a small application to display a .jpg image. But the image is never diplayed in my QLabel. I'm using a QGridLayout with Qt 4.1 and linux. Is there someone who can help me?

Here is my code:
Qt Code:
  1. QLabel *myimage = new QLabel();
  2. myimage->setBackgroundRole(QPalette::Dark);
  3. myimage->setScaledContents(true);
  4.  
  5. QPixmap pix("cylon.jpg");
  6. myimage->setPixmap(pix);
  7.  
  8. QGridLayout *gridLayout = new QGridLayout;
  9. gridLayout->addWidget(myimage, 0, 0);
  10. gridLayout->addWidget(slide, 1, 0);/*a slider*/
  11. gridLayout->addWidget(draw, 0, 1);/*a widget with a QPainter*/
  12. gridLayout->addWidget(quit, 1, 1);/*a quit button*/
  13. gridLayout->setColumnStretch(0, 10);
  14. gridLayout->setColumnStretch(1, 10);
  15. setLayout(gridLayout);
To copy to clipboard, switch view to plain text mode