Commit 8f01f3d6 authored by Karel Slaný's avatar Karel Slaný Committed by Martin Straka

Minor modifications in ImageProvider::requestPixmap().

parent f5a17233
......@@ -25,7 +25,7 @@
#include "src/qml_interaction/image_provider.h"
#include "src/records_management.h"
#define LOGO_EDGE 64
#define DEFAULT_EDGE_LEN 128
ImageProvider::ImageProvider(void)
: QQuickImageProvider(QQuickImageProvider::Pixmap),
......@@ -45,18 +45,18 @@ QPixmap ImageProvider::requestPixmap(const QString &id, QSize *size,
return QPixmap();
}
QPixmap pixmap(Graphics::pixmapFromSvg(svgData, LOGO_EDGE));
QPixmap result;
int edgeLen = DEFAULT_EDGE_LEN;
if (requestedSize.isValid()) {
result = pixmap.scaled(requestedSize, Qt::KeepAspectRatio);
} else {
result = pixmap;
int h = requestedSize.height();
int w = requestedSize.width();
edgeLen = (h < w) ? h : w;
}
QPixmap pixmap(Graphics::pixmapFromSvg(svgData, edgeLen));
if (size != Q_NULLPTR) {
*size = result.size();
*size = pixmap.size();
}
return result;
return pixmap;
}
QByteArray ImageProvider::svg(const QString &id) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment