aboutsummaryrefslogtreecommitdiff
path: root/src/qt/rpcconsole.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2019-08-29 14:56:57 +0200
committerWladimir J. van der Laan <laanwj@protonmail.com>2019-08-29 14:57:06 +0200
commitd20d171f26c27c02dd2c77951fb65da84dbe4e11 (patch)
tree89a8dc74e564b95f6410130857af729c671d371b /src/qt/rpcconsole.cpp
parentdcfd85acb4284e74f74744578309db54b9221859 (diff)
parentc6dd32da697e5a8052cbabe8c7605d27c43a8dfb (diff)
downloadbitcoin-d20d171f26c27c02dd2c77951fb65da84dbe4e11.tar.xz
Merge #16701: qt: Replace functions deprecated in Qt 5.13
c6dd32da697e5a8052cbabe8c7605d27c43a8dfb qt: Replace obsolete functions of QDesktopWidget (Hennadii Stepanov) 1260ecd812e35185898fd555ad3e01d019072bcf qt: Add TextWidth() wrapper (Hennadii Stepanov) Pull request description: The following functions are obsolete in Qt 5.13: - [`QFontMetrics::width()`](https://doc.qt.io/qt-5/qfontmetrics-obsolete.html#width) - [`QDesktopWidget::availableGeometry()`](https://doc.qt.io/qt-5/qdesktopwidget-obsolete.html#availableGeometry) - [`QDesktopWidget::screenGeometry()`](https://doc.qt.io/qt-5/qdesktopwidget-obsolete.html#screenGeometry) This PR replaces them and does not change behavior. Here are some excerpts from the master build log: ``` qt/bitcoingui.cpp: In constructor ‘BitcoinGUI::BitcoinGUI(interfaces::Node&, const PlatformStyle*, const NetworkStyle*, QWidget*)’: qt/bitcoingui.cpp:84:57: warning: ‘const QRect QDesktopWidget::availableGeometry(int) const’ is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations] move(QApplication::desktop()->availableGeometry().center() - frameGeometry().center()); ^ In file included from /home/hebasto/Qt/5.13.0/gcc_64/include/QtWidgets/QDesktopWidget:1:0, from qt/bitcoingui.cpp:43: /home/hebasto/Qt/5.13.0/gcc_64/include/QtWidgets/qdesktopwidget.h:88:67: note: declared here QT_DEPRECATED_X("Use QGuiApplication::screens()") const QRect availableGeometry(int screen = -1) const; ^~~~~~~~~~~~~~~~~ ``` ``` qt/bitcoingui.cpp:1410:74: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] max_width = qMax(max_width, fm.width(BitcoinUnits::longName(unit))); ^ In file included from /home/hebasto/Qt/5.13.0/gcc_64/include/QtWidgets/qwidget.h:50:0, from /home/hebasto/Qt/5.13.0/gcc_64/include/QtWidgets/qdialog.h:44, from /home/hebasto/Qt/5.13.0/gcc_64/include/QtWidgets/QDialog:1, from ./qt/optionsdialog.h:8, from ./qt/bitcoingui.h:12, from qt/bitcoingui.cpp:5: /home/hebasto/Qt/5.13.0/gcc_64/include/QtGui/qfontmetrics.h:108:9: note: declared here int width(const QString &, int len = -1) const; ^~~~~ ``` ``` qt/splashscreen.cpp: In constructor ‘SplashScreen::SplashScreen(interfaces::Node&, Qt::WindowFlags, const NetworkStyle*)’: qt/splashscreen.cpp:127:50: warning: ‘const QRect QDesktopWidget::screenGeometry(int) const’ is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations] move(QApplication::desktop()->screenGeometry().center() - r.center()); ^ In file included from /home/hebasto/Qt/5.13.0/gcc_64/include/QtWidgets/QDesktopWidget:1:0, from qt/splashscreen.cpp:24: /home/hebasto/Qt/5.13.0/gcc_64/include/QtWidgets/qdesktopwidget.h:79:67: note: declared here QT_DEPRECATED_X("Use QGuiApplication::screens()") const QRect screenGeometry(int screen = -1) const; ^~~~~~~~~~~~~~ ``` ACKs for top commit: jonasschnelli: utACK c6dd32da697e5a8052cbabe8c7605d27c43a8dfb Tree-SHA512: deb7bcbf86e1dcc6508bd91288772c2fe8811db79fa2011de37d0469cdd094fbf7fd8c4512c607bed0bd08dc2968e893c0bbc190732c43c69ed1085259df766c
Diffstat (limited to 'src/qt/rpcconsole.cpp')
-rw-r--r--src/qt/rpcconsole.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 289c806536..8a3671dc54 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -28,11 +28,11 @@
#include <wallet/wallet.h>
#endif
-#include <QDesktopWidget>
#include <QKeyEvent>
#include <QMenu>
#include <QMessageBox>
#include <QScrollBar>
+#include <QScreen>
#include <QSettings>
#include <QSignalMapper>
#include <QTime>
@@ -451,7 +451,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
QSettings settings;
if (!restoreGeometry(settings.value("RPCConsoleWindowGeometry").toByteArray())) {
// Restore failed (perhaps missing setting), center the window
- move(QApplication::desktop()->availableGeometry().center() - frameGeometry().center());
+ move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
}
QChar nonbreaking_hyphen(8209);