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
->setBackgroundRole
(QPalette::Base);
imageLabel->setScaledContents(true);
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);
imageLabel = new QLabel;
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored);
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);
To copy to clipboard, switch view to plain text mode
Bookmarks