Talon_Karrde
22nd February 2006, 02:43
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:
QLabel *myimage = new QLabel();
myimage->setBackgroundRole(QPalette::Dark);
myimage->setScaledContents(true);
QPixmap pix("cylon.jpg");
myimage->setPixmap(pix);
QGridLayout *gridLayout = new QGridLayout;
gridLayout->addWidget(myimage, 0, 0);
gridLayout->addWidget(slide, 1, 0);/*a slider*/
gridLayout->addWidget(draw, 0, 1);/*a widget with a QPainter*/
gridLayout->addWidget(quit, 1, 1);/*a quit button*/
gridLayout->setColumnStretch(0, 10);
gridLayout->setColumnStretch(1, 10);
setLayout(gridLayout);
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:
QLabel *myimage = new QLabel();
myimage->setBackgroundRole(QPalette::Dark);
myimage->setScaledContents(true);
QPixmap pix("cylon.jpg");
myimage->setPixmap(pix);
QGridLayout *gridLayout = new QGridLayout;
gridLayout->addWidget(myimage, 0, 0);
gridLayout->addWidget(slide, 1, 0);/*a slider*/
gridLayout->addWidget(draw, 0, 1);/*a widget with a QPainter*/
gridLayout->addWidget(quit, 1, 1);/*a quit button*/
gridLayout->setColumnStretch(0, 10);
gridLayout->setColumnStretch(1, 10);
setLayout(gridLayout);