mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
improve:Win Specific, replace deprecated method
This commit is contained in:
parent
46b4151cc4
commit
3b4c105655
|
@ -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 );
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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 )
|
||||||
|
|
Loading…
Reference in a new issue