Mercurial > hg > svgui
changeset 1478:d39db4673676 by-id
Fix a number of Qt deprecation warnings
author | Chris Cannam |
---|---|
date | Wed, 03 Jul 2019 08:55:02 +0100 |
parents | 0769eaacc6bf |
children | 9bf8aa2916e9 |
files | widgets/KeyReference.cpp widgets/LEDButton.cpp widgets/LayerTreeDialog.cpp widgets/ModelDataTableDialog.cpp widgets/Panner.cpp widgets/PluginReviewDialog.cpp widgets/TextAbbrev.cpp widgets/Thumbwheel.cpp widgets/TransformFinder.cpp widgets/WindowShapePreview.cpp |
diffstat | 10 files changed, 36 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- 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 <QVBoxLayout> #include <QDialogButtonBox> #include <QApplication> -#include <QDesktopWidget> +#include <QScreen> 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;
--- 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(); } }
--- 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 <QDialogButtonBox> #include <QHeaderView> #include <QApplication> -#include <QDesktopWidget> +#include <QScreen> 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;
--- 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 <QDialogButtonBox> #include <QHeaderView> #include <QApplication> -#include <QDesktopWidget> +#include <QScreen> #include <QAction> #include <QToolBar> @@ -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;
--- 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);
--- 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 <QDialogButtonBox> #include <QFileInfo> #include <QHeaderView> -#include <QDesktopWidget> +#include <QScreen> #include <QApplication> #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);
--- 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; }
--- 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));
--- 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 <QDialogButtonBox> #include <QScrollArea> #include <QApplication> -#include <QDesktopWidget> +#include <QScreen> #include <QTimer> #include <QAction> @@ -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;
--- 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);