improve:Win Specific, replace deprecated method

This commit is contained in:
xiaoyifang 2022-01-08 22:02:29 +08:00
parent 46b4151cc4
commit 3b4c105655
4 changed files with 6 additions and 6 deletions

View file

@ -162,7 +162,7 @@ void ArticleWebView::wheelEvent( QWheelEvent *ev )
SystemParametersInfo( SPI_GETWHEELSCROLLLINES, 0, &nLines, 0 ); SystemParametersInfo( SPI_GETWHEELSCROLLLINES, 0, &nLines, 0 );
if( nLines == WHEEL_PAGESCROLL ) 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 ); Qt::NoModifier );
QApplication::sendEvent( this, &kev ); QApplication::sendEvent( this, &kev );

View file

@ -17,6 +17,7 @@
#include "initializing.hh" #include "initializing.hh"
#include <qt_windows.h> #include <qt_windows.h>
#include <uxtheme.h> #include <uxtheme.h>
#include <QOperatingSystemVersion>
#endif #endif
@ -248,8 +249,7 @@ FullTextSearchDialog::FullTextSearchDialog( QWidget * parent,
oldBarStyle = 0; oldBarStyle = 0;
if( QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA if( QOperatingSystemVersion::current () >= QOperatingSystemVersion::Windows7
&& ( QSysInfo::windowsVersion() & QSysInfo::WV_NT_based )
&& !IsThemeActive() ) && !IsThemeActive() )
{ {
QStyle * barStyle = WindowsStyle::instance().getStyle(); QStyle * barStyle = WindowsStyle::instance().getStyle();

View file

@ -8,6 +8,7 @@
#if defined( Q_OS_WIN32 ) #if defined( Q_OS_WIN32 )
#include <qt_windows.h> #include <qt_windows.h>
#include <uxtheme.h> #include <uxtheme.h>
#include <QOperatingSystemVersion>
WindowsStyle::WindowsStyle() WindowsStyle::WindowsStyle()
{ {
@ -41,8 +42,7 @@ Initializing::Initializing( QWidget * parent, bool showOnStartup ): QDialog( par
oldBarStyle = 0; oldBarStyle = 0;
if( QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA if( QOperatingSystemVersion::current () >= QOperatingSystemVersion::Windows7
&& ( QSysInfo::windowsVersion() & QSysInfo::WV_NT_based )
&& !IsThemeActive() ) && !IsThemeActive() )
{ {
QStyle * barStyle = WindowsStyle::instance().getStyle(); QStyle * barStyle = WindowsStyle::instance().getStyle();

View file

@ -742,7 +742,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if( cfg.normalMainWindowGeometry.width() <= 0 ) 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 ); cfg.normalMainWindowGeometry.setRect( r.width() / 4, r.height() / 4, r.width() / 2, r.height() / 2 );
} }
if( cfg.maximizedMainWindowGeometry.width() > 0 ) if( cfg.maximizedMainWindowGeometry.width() > 0 )