GUI: Preliminary support for HiDPI splashscreen
This commit is contained in:
BIN
src/Gui/Icons/freecadsplash2x.png
Normal file
BIN
src/Gui/Icons/freecadsplash2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 281 KiB |
@@ -1,6 +1,7 @@
|
||||
<RCC>
|
||||
<qresource prefix="/icons">
|
||||
<file>freecadsplash.png</file>
|
||||
<file>freecadsplash2x.png</file>
|
||||
<file>freecadabout.png</file>
|
||||
<file>background.png</file>
|
||||
<file>mouse_pointer.svg</file>
|
||||
|
||||
@@ -1525,7 +1525,15 @@ QPixmap MainWindow::splashImage() const
|
||||
|
||||
// now try the icon paths
|
||||
if (splash_image.isNull()) {
|
||||
splash_image = Gui::BitmapFactory().pixmap(splash_path.c_str());
|
||||
if (qApp->devicePixelRatio() > 1.0) {
|
||||
// For HiDPI screens, we have a double-resolution version of the splash image
|
||||
splash_path += "2x";
|
||||
splash_image = Gui::BitmapFactory().pixmap(splash_path.c_str());
|
||||
splash_image.setDevicePixelRatio(2.0);
|
||||
}
|
||||
else {
|
||||
splash_image = Gui::BitmapFactory().pixmap(splash_path.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// include application name and version number
|
||||
@@ -1559,14 +1567,14 @@ QPixmap MainWindow::splashImage() const
|
||||
}
|
||||
|
||||
QFont fontExe = painter.font();
|
||||
fontExe.setPointSize(20);
|
||||
fontExe.setPointSizeF(20.0);
|
||||
QFontMetrics metricExe(fontExe);
|
||||
int l = QtTools::horizontalAdvance(metricExe, title);
|
||||
int w = splash_image.width();
|
||||
int h = splash_image.height();
|
||||
|
||||
QFont fontVer = painter.font();
|
||||
fontVer.setPointSize(12);
|
||||
fontVer.setPointSizeF(12.0);
|
||||
QFontMetrics metricVer(fontVer);
|
||||
int v = QtTools::horizontalAdvance(metricVer, version);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user