# HG changeset patch # User Chris Cannam # Date 1562140502 -3600 # Node ID d39db46736762185742ab67a704d6dcc2bad821a # Parent 0769eaacc6bf6d68235959c027ea10eea6af3406 Fix a number of Qt deprecation warnings diff -r 0769eaacc6bf -r d39db4673676 widgets/KeyReference.cpp --- a/widgets/KeyReference.cpp Tue Jul 02 19:05:45 2019 +0100 +++ b/widgets/KeyReference.cpp Wed Jul 03 08:55:02 2019 +0100 @@ -21,7 +21,7 @@ #include #include #include -#include +#include KeyReference::KeyReference() : m_text(nullptr), @@ -185,9 +185,9 @@ layout->addWidget(bb); m_dialog->show(); - - QDesktopWidget *desktop = QApplication::desktop(); - QRect available = desktop->availableGeometry(); + + QScreen *screen = QGuiApplication::primaryScreen(); + QRect available = screen->availableGeometry(); int width = available.width() * 3 / 5; int height = available.height() * 2 / 3; diff -r 0769eaacc6bf -r d39db4673676 widgets/LEDButton.cpp --- a/widgets/LEDButton.cpp Tue Jul 02 19:05:45 2019 +0100 +++ b/widgets/LEDButton.cpp Wed Jul 03 08:55:02 2019 +0100 @@ -49,7 +49,7 @@ QColor col(Qt::green); d = new LEDButton::LEDButtonPrivate; d->dark_factor = 300; - d->offcolor = col.dark(300); + d->offcolor = col.darker(300); setColor(col); } @@ -61,7 +61,7 @@ { d = new LEDButton::LEDButtonPrivate; d->dark_factor = 300; - d->offcolor = col.dark(300); + d->offcolor = col.darker(300); setColor(col); } @@ -72,7 +72,7 @@ { d = new LEDButton::LEDButtonPrivate; d->dark_factor = 300; - d->offcolor = col.dark(300); + d->offcolor = col.darker(300); setColor(col); } @@ -160,7 +160,7 @@ // Now draw the bright spot on the LED: while (light_width) { - color = color.light( light_quote ); // make color lighter + color = color.lighter( light_quote ); // make color lighter pen.setColor( color ); // set color as pen color paint.setPen( pen ); // select the pen for drawing paint.drawEllipse( pos, pos, light_width, light_width ); // draw the ellipse (circle) @@ -197,7 +197,7 @@ int w = width - pen.width()/2; paint.drawArc(pen.width()/2 + 1, pen.width()/2 + 1, w - 2, w - 2, angle + arc, 240); paint.drawArc(pen.width()/2 + 1, pen.width()/2 + 1, w - 2, w - 2, angle - arc, 240); - color = color.dark(110); //FIXME: this should somehow use the contrast value + color = color.darker(110); //FIXME: this should somehow use the contrast value } // end for ( angle = 720; angle < 6480; angle += 160 ) paint.end(); @@ -238,7 +238,7 @@ { if(led_color!=col) { led_color = col; - d->offcolor = col.dark(d->dark_factor); + d->offcolor = col.darker(d->dark_factor); update(); } } @@ -248,7 +248,7 @@ { if (d->dark_factor != darkfactor) { d->dark_factor = darkfactor; - d->offcolor = led_color.dark(darkfactor); + d->offcolor = led_color.darker(darkfactor); update(); } } diff -r 0769eaacc6bf -r d39db4673676 widgets/LayerTreeDialog.cpp --- a/widgets/LayerTreeDialog.cpp Tue Jul 02 19:05:45 2019 +0100 +++ b/widgets/LayerTreeDialog.cpp Wed Jul 03 08:55:02 2019 +0100 @@ -25,7 +25,7 @@ #include #include #include -#include +#include LayerTreeDialog::LayerTreeDialog(PaneStack *stack, QWidget *parent) : QDialog(parent), @@ -89,8 +89,8 @@ grid->addWidget(bb, 2, 0); grid->setRowStretch(2, 0); - QDesktopWidget *desktop = QApplication::desktop(); - QRect available = desktop->availableGeometry(); + QScreen *screen = QGuiApplication::primaryScreen(); + QRect available = screen->availableGeometry(); int width = available.width() / 2; int height = available.height() / 3; diff -r 0769eaacc6bf -r d39db4673676 widgets/ModelDataTableDialog.cpp --- a/widgets/ModelDataTableDialog.cpp Tue Jul 02 19:05:45 2019 +0100 +++ b/widgets/ModelDataTableDialog.cpp Wed Jul 03 08:55:02 2019 +0100 @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -144,8 +144,8 @@ grid->addWidget(bb, 2, 0); grid->setRowStretch(2, 0); - QDesktopWidget *desktop = QApplication::desktop(); - QRect available = desktop->availableGeometry(); + QScreen *screen = QGuiApplication::primaryScreen(); + QRect available = screen->availableGeometry(); int width = available.width() / 3; int height = available.height() / 2; diff -r 0769eaacc6bf -r d39db4673676 widgets/Panner.cpp --- a/widgets/Panner.cpp Tue Jul 02 19:05:45 2019 +0100 +++ b/widgets/Panner.cpp Wed Jul 03 08:55:02 2019 +0100 @@ -162,7 +162,7 @@ QPainter paint(this); paint.setRenderHint(QPainter::Antialiasing, false); - QColor bg(palette().background().color()); + QColor bg(palette().window().color()); bg.setAlpha(m_backgroundAlpha); int penWidth = WidgetScale::scalePixelSize(1); diff -r 0769eaacc6bf -r d39db4673676 widgets/PluginReviewDialog.cpp --- a/widgets/PluginReviewDialog.cpp Tue Jul 02 19:05:45 2019 +0100 +++ b/widgets/PluginReviewDialog.cpp Wed Jul 03 08:55:02 2019 +0100 @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include "plugin/FeatureExtractionPluginFactory.h" @@ -129,8 +129,8 @@ int twidth = m_table->horizontalHeader()->length(); int theight = m_table->verticalHeader()->length(); - QDesktopWidget *desktop = QApplication::desktop(); - QRect available = desktop->availableGeometry(); + QScreen *screen = QGuiApplication::primaryScreen(); + QRect available = screen->availableGeometry(); int width = std::min(twidth + 30, (available.width() * 3) / 4); int height = std::min(theight + 30, (available.height() * 3) / 4); diff -r 0769eaacc6bf -r d39db4673676 widgets/TextAbbrev.cpp --- a/widgets/TextAbbrev.cpp Tue Jul 02 19:05:45 2019 +0100 +++ b/widgets/TextAbbrev.cpp Wed Jul 03 08:55:02 2019 +0100 @@ -38,6 +38,11 @@ int TextAbbrev::getFuzzWidth(const QFontMetrics &metrics, QString ellipsis) { + // Qt 5.13 deprecates QFontMetrics::width(), but its suggested + // replacement (horizontalAdvance) was only added in Qt 5.11 + // which is too new for us +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + int width = metrics.width(ellipsis); return width * 2; } diff -r 0769eaacc6bf -r d39db4673676 widgets/Thumbwheel.cpp --- a/widgets/Thumbwheel.cpp Tue Jul 02 19:05:45 2019 +0100 +++ b/widgets/Thumbwheel.cpp Wed Jul 03 08:55:02 2019 +0100 @@ -466,7 +466,7 @@ QPainter paint(&m_cache); paint.setClipRect(m_cache.rect()); - paint.fillRect(subclip, palette().background().color()); + paint.fillRect(subclip, palette().window().color()); paint.setRenderHint(QPainter::Antialiasing, true); @@ -564,7 +564,7 @@ } paint.setPen(fc); - paint.setBrush(palette().background().color()); + paint.setBrush(palette().window().color()); if (m_orientation == Qt::Horizontal) { paint.drawRect(QRectF(x0, bw, x1 - x0, h - bw*2)); diff -r 0769eaacc6bf -r d39db4673676 widgets/TransformFinder.cpp --- a/widgets/TransformFinder.cpp Tue Jul 02 19:05:45 2019 +0100 +++ b/widgets/TransformFinder.cpp Wed Jul 03 08:55:02 2019 +0100 @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include @@ -92,8 +92,8 @@ connect(down, SIGNAL(triggered()), this, SLOT(down())); addAction(down); - QDesktopWidget *desktop = QApplication::desktop(); - QRect available = desktop->availableGeometry(); + QScreen *screen = QApplication::primaryScreen(); + QRect available = screen->availableGeometry(); int width = available.width() / 2; int height = available.height() / 2; diff -r 0769eaacc6bf -r d39db4673676 widgets/WindowShapePreview.cpp --- a/widgets/WindowShapePreview.cpp Tue Jul 02 19:05:45 2019 +0100 +++ b/widgets/WindowShapePreview.cpp Wed Jul 03 08:55:02 2019 +0100 @@ -113,6 +113,11 @@ path.addRect(0, 0, w, h + 1); timePainter.drawPath(path); + // Qt 5.13 deprecates QFontMetrics::width(), but its suggested + // replacement (horizontalAdvance) was only added in Qt 5.11 + // which is too new for us +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + QFont font; font.setPixelSize(int(10 * scaleRatio)); font.setItalic(true);