[Qt-interest] Problem in multi QLabel & QGridLayout

Ravi_Kalepalli Ravi_Kalepalli at Satyam.com
Mon Feb 23 06:32:02 CET 2009


Hi
            I am trying to display 2 images with QLabel. But it is always displaying second image only ( book.bmp in my case).
            The first image getting overlapped by the second (I think)
            Could anybody help in this?

Code:

QGridLayout *multiLayout = new QGridLayout(this);

            imageLabel = new QLabel(this);
            imageLabel->setBackgroundRole(QPalette::Base);
            imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
            imageLabel->setScaledContents(true);
            setCentralWidget(imageLabel);

            imageLabel2 = new QLabel(this);
            imageLabel2->setBackgroundRole(QPalette::Base);
            imageLabel2->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
            imageLabel2->setScaledContents(true);
            setCentralWidget(imageLabel2);

            multiLayout->addWidget(imageLabel,0,0);
            multiLayout->addWidget(imageLabel2,1,1);


            QString NextImagepath = "c:\\Data\\Images\\Pictures\\battery.jpg";
            QPixmap Nextimage(NextImagepath);
            imageLabel->setPixmap(Nextimage);

            QString NextImagepath2 = "c:\\Data\\Images\\Pictures\\ book.bmp";
            QPixmap Nextimage2(NextImagepath2);
            imageLabel2->setPixmap(Nextimage2);

            setLayout(multiLayout);


Thanks and Regards

Ravi Kalepalli
Telephone: 080-66577808
Mobile: 9880724688
[cid:image001.gif at 01C995A6.0D5F9F10]


________________________________
DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090223/b603df18/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 8498 bytes
Desc: image001.gif
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090223/b603df18/attachment.gif 


More information about the Qt-interest-old mailing list