| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
1 |
#include "thumbnailworker.h" |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
2 |
#include <QImageReader> |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
3 |
|
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
4 |
ThumbnailWorker::ThumbnailWorker(const QString &path, int row) |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
5 |
: m_path(path), m_row(row) |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
6 |
{ |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
7 |
setAutoDelete(true); |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
8 |
} |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
9 |
|
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
10 |
void ThumbnailWorker::run() |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
11 |
{ |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
12 |
QImageReader reader(m_path); |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
13 |
reader.setAutoTransform(true); |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
14 |
|
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
15 |
QImage image = reader.read(); |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
16 |
QPixmap thumb; |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
17 |
|
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
18 |
if (!image.isNull()) |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
19 |
{ |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
20 |
thumb = QPixmap::fromImage( |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
21 |
image.scaled(128, 128, |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
22 |
Qt::KeepAspectRatio, |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
23 |
Qt::SmoothTransformation)); |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
24 |
} |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
25 |
|
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
26 |
emit finished(m_row, thumb); |
| cec3b5da |
Poul Sander |
2026-02-19 19:17 |
27 |
} |
|
|
1970-01-01 00:00 |
28 |
|