#include #include #include #include #include #include #include #include class ImageTest : public QWidget { public: ImageTest(const QString& imagePath, QWidget* parent = nullptr) : QWidget(parent) { setWindowTitle("QPixmap Scaling Test"); QVBoxLayout* layout = new QVBoxLayout(this); QPixmap pixmap(imagePath); QPixmap scaledPixmap = pixmap.scaled( 28, 28, Qt::KeepAspectRatio, Qt::SmoothTransformation ); QLabel* label = new QLabel(); label->setPixmap(scaledPixmap); label->setCursor(QCursor(Qt::PointingHandCursor)); layout->addWidget(label); } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); // Change this to a valid image path on your system QString imagePath = QDir::current().filePath("imdb.png"); ImageTest window(imagePath); window.show(); return app.exec(); }