blob: 97cdbef486bf6284f83be532e40beb9a960a9769 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#include "horizonwizardpage.hh"
using std::string;
void HorizonWizardPage::loadWatermark(string page)
{
QPixmap pixmap;
qreal pixelRatio = 0;
string path = ":/wizard_pixmaps/resources/";
path += page;
path += "-";
if(window()->devicePixelRatioF() == 2.0)
{
path += "high";
pixelRatio = 2.0;
} else if(window()->devicePixelRatioF() == 1.0) {
path += "low";
pixelRatio = 1.0;
} else {
path += "high";
}
path += ".png";
pixmap = QPixmap(path.c_str());
// Handle cases where ratio is not exactly 1.0 or 2.0
// Wizard machinary automatically uses FastTransformation, which is
// ugly as sin.
if(pixelRatio == 0)
{
qreal width = 232 * window()->devicePixelRatioF();
qreal height = 380 * window()->devicePixelRatioF();
QSize newSize = QSize(width, height);
pixmap = pixmap.scaled(newSize, Qt::KeepAspectRatio,
Qt::SmoothTransformation);
pixmap.setDevicePixelRatio(window()->devicePixelRatioF());
} else {
pixmap.setDevicePixelRatio(pixelRatio);
}
setPixmap(QWizard::WatermarkPixmap, pixmap);
}
|