first version

This commit is contained in:
2025-02-19 15:23:20 +01:00
parent acca5fb630
commit c4d2e44836
10 changed files with 70 additions and 22 deletions

27
imagegallery.cpp Normal file
View File

@@ -0,0 +1,27 @@
#include "imagegallery.h"
#include <QPixmap>
ImageGallery::ImageGallery(QWidget *parent) : QWidget(parent)
{
scrollArea = new QScrollArea(this);
scrollWidget = new QWidget(scrollArea);
scrollLayout = new QVBoxLayout(scrollWidget);
scrollArea->setWidgetResizable(true);
scrollArea->setWidget(scrollWidget);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(scrollArea);
setLayout(mainLayout);
}
void ImageGallery::addImage(const QString &imagePath)
{
QLabel *imageLabel = new QLabel(scrollWidget);
QPixmap pixmap(imagePath);
imageLabel->setPixmap(pixmap.scaledToWidth(400, Qt::SmoothTransformation));
imageLabel->setAlignment(Qt::AlignCenter);
scrollLayout->addWidget(imageLabel);
imageLabels.append(imageLabel);
}