Assign the pixel_ratio of graphics params to the Qt pixmap of the image.
+#include <math.h> /* ceil */
#include "GuiImage.h"
#include "qt_helpers.h"
#include "GuiImage.h"
#include "qt_helpers.h"
unsigned int GuiImage::width() const
{
unsigned int GuiImage::width() const
{
+#if QT_VERSION >= 0x050000
+ return is_transformed_ ?
+ ceil(transformed_.width() / transformed_.devicePixelRatio()) :
+ ceil(original_.width() / original_.devicePixelRatio());
+#else
return is_transformed_ ? transformed_.width() : original_.width();
return is_transformed_ ? transformed_.width() : original_.width();
}
unsigned int GuiImage::height() const
{
}
unsigned int GuiImage::height() const
{
+#if QT_VERSION >= 0x050000
+ return is_transformed_ ?
+ ceil(transformed_.height() / transformed_.devicePixelRatio()) :
+ ceil(original_.height() / original_.devicePixelRatio());
+#else
return is_transformed_ ? transformed_.height() : original_.height();
return is_transformed_ ? transformed_.height() : original_.height();
if (!load())
return false;
}
if (!load())
return false;
}
+
+#if QT_VERSION >= 0x050000
+ original_.setDevicePixelRatio(params.pixel_ratio);
+#endif
+
is_transformed_ = clip(params);
is_transformed_ |= rotate(params);
is_transformed_ |= scale(params);
is_transformed_ = clip(params);
is_transformed_ |= rotate(params);
is_transformed_ |= scale(params);