File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99#include < QTimer>
1010#include < QScrollArea>
1111#include < QLabel>
12+ #include < QPixmap>
1213
1314using zclipboard::zGui::ZDialog;
1415
@@ -61,12 +62,16 @@ void ZDialog::showZImageDialog(const QImage &image, QWidget *parent) {
6162 zDialog->setWindowTitle (" zClipboard Image Viewer" );
6263 zDialog->resize (600 , 600 );
6364
64- imageLabel->setPixmap (QPixmap::fromImage (image));
65+ QPixmap pixmap = QPixmap::fromImage (image);
66+ QSize maxSize = zDialog->size () * 0.9 ;
67+ QPixmap scaledPixmap = pixmap.scaled (maxSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
68+
69+ imageLabel->setPixmap (scaledPixmap);
70+ imageLabel->adjustSize ();
6571 imageLabel->setAlignment (Qt::AlignCenter);
66- imageLabel->setScaledContents (true );
6772
6873 scrollArea->setWidget (imageLabel);
69- scrollArea->setWidgetResizable (true );
74+ scrollArea->setWidgetResizable (false );
7075
7176 zLayout->addWidget (scrollArea, 0 , 0 );
7277
You can’t perform that action at this time.
0 commit comments