From 3b4c1056554056d1f48facee4c03a7057b2aad25 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Sat, 8 Jan 2022 22:02:29 +0800 Subject: [PATCH] improve:Win Specific, replace deprecated method --- articlewebview.cc | 2 +- fulltextsearch.cc | 4 ++-- initializing.cc | 4 ++-- mainwindow.cc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/articlewebview.cc b/articlewebview.cc index 1d412386..af5bedf5 100644 --- a/articlewebview.cc +++ b/articlewebview.cc @@ -162,7 +162,7 @@ void ArticleWebView::wheelEvent( QWheelEvent *ev ) SystemParametersInfo( SPI_GETWHEELSCROLLLINES, 0, &nLines, 0 ); if( nLines == WHEEL_PAGESCROLL ) { - QKeyEvent kev( QEvent::KeyPress, ev->delta() > 0 ? Qt::Key_PageUp : Qt::Key_PageDown, + QKeyEvent kev( QEvent::KeyPress, ev->angleDelta ().y () > 0 ? Qt::Key_PageUp : Qt::Key_PageDown, Qt::NoModifier ); QApplication::sendEvent( this, &kev ); diff --git a/fulltextsearch.cc b/fulltextsearch.cc index 4c83f57f..02b24dce 100644 --- a/fulltextsearch.cc +++ b/fulltextsearch.cc @@ -17,6 +17,7 @@ #include "initializing.hh" #include #include +#include #endif @@ -248,8 +249,7 @@ FullTextSearchDialog::FullTextSearchDialog( QWidget * parent, oldBarStyle = 0; - if( QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA - && ( QSysInfo::windowsVersion() & QSysInfo::WV_NT_based ) + if( QOperatingSystemVersion::current () >= QOperatingSystemVersion::Windows7 && !IsThemeActive() ) { QStyle * barStyle = WindowsStyle::instance().getStyle(); diff --git a/initializing.cc b/initializing.cc index e6d68b4f..8d1d4a81 100644 --- a/initializing.cc +++ b/initializing.cc @@ -8,6 +8,7 @@ #if defined( Q_OS_WIN32 ) #include #include +#include WindowsStyle::WindowsStyle() { @@ -41,8 +42,7 @@ Initializing::Initializing( QWidget * parent, bool showOnStartup ): QDialog( par oldBarStyle = 0; - if( QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA - && ( QSysInfo::windowsVersion() & QSysInfo::WV_NT_based ) + if( QOperatingSystemVersion::current () >= QOperatingSystemVersion::Windows7 && !IsThemeActive() ) { QStyle * barStyle = WindowsStyle::instance().getStyle(); diff --git a/mainwindow.cc b/mainwindow.cc index d5bceb30..0e934436 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -742,7 +742,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ): #ifdef Q_OS_WIN if( cfg.normalMainWindowGeometry.width() <= 0 ) { - QRect r = QApplication::desktop()->availableGeometry(); + QRect r = QGuiApplication::primaryScreen ()->geometry (); cfg.normalMainWindowGeometry.setRect( r.width() / 4, r.height() / 4, r.width() / 2, r.height() / 2 ); } if( cfg.maximizedMainWindowGeometry.width() > 0 )