From 9732ecc321daab06026f4496a6724d6bdbc0941a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 22 Mar 2019 10:35:22 +0100 Subject: [PATCH] Manual dialog test: Fix deprecation warnings filedialogpanel.cpp:441:55: warning: 'bool QFileDialog::confirmOverwrite() const' is deprecated: Use !testOption(DontConfirmOverwrite) instead [-Wdeprecated-declarations] filedialogpanel.cpp:443:53: warning: 'bool QFileDialog::resolveSymlinks() const' is deprecated: Use !testOption(DontResolveSymlinks) instead [-Wdeprecated-declarations] printdialogpanel.cpp:708:62: warning: 'const QRect QDesktopWidget::availableGeometry(int) const' is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations] Change-Id: I087615b7e62b5fc11ec1063590fe55b2615f95fd Reviewed-by: Christian Ehrlicher --- tests/manual/dialogs/filedialogpanel.cpp | 4 ++-- tests/manual/dialogs/printdialogpanel.cpp | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp index e628dd2265..800baae45e 100644 --- a/tests/manual/dialogs/filedialogpanel.cpp +++ b/tests/manual/dialogs/filedialogpanel.cpp @@ -438,9 +438,9 @@ void FileDialogPanel::restoreDefaults() setComboBoxValue(m_viewMode, d.viewMode()); m_showDirsOnly->setChecked(d.testOption(QFileDialog::ShowDirsOnly)); m_allowedSchemes->setText(QString()); - m_confirmOverWrite->setChecked(d.confirmOverwrite()); + m_confirmOverWrite->setChecked(!d.testOption(QFileDialog::DontConfirmOverwrite)); m_nameFilterDetailsVisible->setChecked(!d.testOption(QFileDialog::HideNameFilterDetails)); - m_resolveSymLinks->setChecked(d.resolveSymlinks()); + m_resolveSymLinks->setChecked(!d.testOption(QFileDialog::DontResolveSymlinks)); m_readOnly->setChecked(d.isReadOnly()); m_native->setChecked(true); m_customDirIcons->setChecked(d.testOption(QFileDialog::DontUseCustomDirectoryIcons)); diff --git a/tests/manual/dialogs/printdialogpanel.cpp b/tests/manual/dialogs/printdialogpanel.cpp index d999dbc30c..8d64d2f6a6 100644 --- a/tests/manual/dialogs/printdialogpanel.cpp +++ b/tests/manual/dialogs/printdialogpanel.cpp @@ -55,6 +55,10 @@ #include #include +#if QT_VERSION >= 0x050000 +# include +#endif + const FlagData printerModeComboData[] = { {"ScreenResolution", QPrinter::ScreenResolution}, @@ -705,7 +709,13 @@ void PrintDialogPanel::showPreviewDialog() { applySettings(m_printer.data()); PrintPreviewDialog dialog(m_printer.data(), this); - dialog.resize(QApplication::desktop()->availableGeometry().size() * 4/ 5); +#if QT_VERSION >= 0x050000 + const int screenNumber = QApplication::desktop()->screenNumber(this); + const QSize availableSize = QGuiApplication::screens().at(screenNumber)->availableSize(); +#else + const QSize availableSize = QApplication::desktop()->availableGeometry().size(); +#endif + dialog.resize(availableSize * 4/ 5); if (dialog.exec() == QDialog::Accepted) retrieveSettings(m_printer.data()); }