comparison main/SVSplash.cpp @ 2306:a1c14880404b

Merge from branch by-id
author Chris Cannam
date Wed, 17 Jul 2019 14:28:24 +0100
parents eb7f4579e5cc
children 7e70382e6ece
comparison
equal deleted inserted replaced
2296:a54082a29106 2306:a1c14880404b
16 16
17 #include "../version.h" 17 #include "../version.h"
18 18
19 #include <QPainter> 19 #include <QPainter>
20 #include <QApplication> 20 #include <QApplication>
21 #include <QDesktopWidget> 21 #include <QScreen>
22 #include <QSvgRenderer> 22 #include <QSvgRenderer>
23 23
24 #include <cmath> 24 #include <cmath>
25 25
26 #include <iostream> 26 #include <iostream>
31 setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); 31 setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
32 32
33 QPixmap *p1 = new QPixmap(":icons/scalable/sv-splash.png"); 33 QPixmap *p1 = new QPixmap(":icons/scalable/sv-splash.png");
34 34
35 int w = p1->width(), h = p1->height(); 35 int w = p1->width(), h = p1->height();
36 QRect desk = QApplication::desktop()->availableGeometry(); 36 QScreen *screen = QApplication::primaryScreen();
37 QRect desk = screen->availableGeometry();
37 38
38 double dpratio = devicePixelRatio(); 39 double dpratio = devicePixelRatio();
39 double widthMultiple = double(desk.width()) / double(w); 40 double widthMultiple = double(desk.width()) / double(w);
40 41
41 int sw = w, sh = h; 42 int sw = w, sh = h;
87 } 88 }
88 89
89 void 90 void
90 SVSplash::drawContents(QPainter *painter) 91 SVSplash::drawContents(QPainter *painter)
91 { 92 {
93 // Qt 5.13 deprecates QFontMetrics::width(), but its suggested
94 // replacement (horizontalAdvance) was only added in Qt 5.11
95 // which is too new for us
96 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
97
92 painter->drawPixmap(rect(), *m_pixmap, m_pixmap->rect()); 98 painter->drawPixmap(rect(), *m_pixmap, m_pixmap->rect());
93 QString text = QString("v%1").arg(SV_VERSION); 99 QString text = QString("v%1").arg(SV_VERSION);
94 painter->setPen(Qt::black); 100 painter->setPen(Qt::black);
95 painter->drawText 101 painter->drawText
96 (width() - painter->fontMetrics().width(text) - (width()/50), 102 (width() - painter->fontMetrics().width(text) - (width()/50),