comparison main/SVSplash.cpp @ 2300:eb7f4579e5cc by-id

Updates throughout for ModelById logic
author Chris Cannam
date Thu, 04 Jul 2019 14:32:08 +0100
parents 82cac4a6c581
children 7e70382e6ece
comparison
equal deleted inserted replaced
2299:bb0f5a8f93fe 2300:eb7f4579e5cc
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),