deck99
19th March 2011, 05:34
Hi........
I have a problem while displaying an image in label. when u simply open l.png its image display is horizontal but when u open with code display is in vertical. i want the image as it is seen in simply opening and no scrollbar should come full image should be displayed on the label with no scollbars.
imageLabel = new QLabel;
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ig nored);
imageLabel->setScaledContents(true);
scrollArea = new QScrollArea;
scrollArea->setBackgroundRole(QPalette::Dark);
scrollArea->setWidget(imageLabel);
setCentralWidget(scrollArea);
setWindowTitle(tr("Image Viewer"));
resize(800, 900);
QImage image("/home/karl/Desktop/l.tif");
imageLabel->setPixmap(QPixmap::fromImage(image));
scaleFactor = 1.0;
scrollArea->setWidgetResizable(1);
I have a problem while displaying an image in label. when u simply open l.png its image display is horizontal but when u open with code display is in vertical. i want the image as it is seen in simply opening and no scrollbar should come full image should be displayed on the label with no scollbars.
imageLabel = new QLabel;
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ig nored);
imageLabel->setScaledContents(true);
scrollArea = new QScrollArea;
scrollArea->setBackgroundRole(QPalette::Dark);
scrollArea->setWidget(imageLabel);
setCentralWidget(scrollArea);
setWindowTitle(tr("Image Viewer"));
resize(800, 900);
QImage image("/home/karl/Desktop/l.tif");
imageLabel->setPixmap(QPixmap::fromImage(image));
scaleFactor = 1.0;
scrollArea->setWidgetResizable(1);