Hi ALL,
I m using Qt 4.1.5 on my MAC.
I have a dialog in which i m showing the image on a Label and if the image is bigger than there is a scroll area to scroll it.
But if image is small then it shows it in the Upper left corner of the dialog but I want that the image should start from the center.
Im using the following code o do it..
imageLabel->setAlignment (Qt::AlignCenter);
imageLabel
->setBackgroundRole
(QPalette::Base);
imageLabel->setPixmap(pixmap);
scrollArea
->setBackgroundRole
(QPalette::Dark);
scrollArea->setWidget(imageLabel);
scrollArea->setGeometry (2,0,460,490);
QLabel *imageLabel = new QLabel(pFilePreviewDlg);
imageLabel->setAlignment (Qt::AlignCenter);
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
imageLabel->setPixmap(pixmap);
QScrollArea *scrollArea = new QScrollArea(pFilePreviewDlg);
scrollArea->setBackgroundRole(QPalette::Dark);
scrollArea->setWidget(imageLabel);
scrollArea->setGeometry (2,0,460,490);
To copy to clipboard, switch view to plain text mode
So if any body knows how I can set the image on the center on a dialog then plz help me.
Thanks.
Bookmarks