aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--dist/changes-5.10.022
-rw-r--r--dist/changes-5.10.126
-rw-r--r--examples/winextras/iconextractor/main.cpp20
-rw-r--r--examples/winextras/musicplayer/main.cpp2
-rw-r--r--examples/winextras/musicplayer/musicplayer.cpp26
-rw-r--r--examples/winextras/musicplayer/volumebutton.cpp22
-rw-r--r--examples/winextras/quickplayer/main.cpp29
-rw-r--r--src/winextras/qwineventfilter.cpp2
-rw-r--r--src/winextras/qwinfunctions.cpp26
-rw-r--r--src/winextras/qwinfunctions.h2
-rw-r--r--src/winextras/qwinfunctions_p.cpp74
-rw-r--r--src/winextras/qwinfunctions_p.h36
-rw-r--r--src/winextras/qwinjumplist.h2
-rw-r--r--src/winextras/qwintaskbarbutton.cpp2
-rw-r--r--src/winextras/qwintaskbarbutton.h2
-rw-r--r--src/winextras/qwintaskbarprogress.h2
-rw-r--r--src/winextras/qwinthumbnailtoolbar.cpp27
-rw-r--r--src/winextras/qwinthumbnailtoolbar.h2
-rw-r--r--src/winextras/qwinthumbnailtoolbutton.h2
-rw-r--r--src/winextras/winextras.pro1
-rw-r--r--src/winextras/winshobjidl_p.h2
-rw-r--r--tests/auto/qwinjumplist/tst_qwinjumplist.cpp5
-rw-r--r--tests/manual/jumplist/testwidget.h2
24 files changed, 148 insertions, 190 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 7e0ad0e..dc68d38 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,3 +1,3 @@
load(qt_build_config)
-MODULE_VERSION = 5.9.5
+MODULE_VERSION = 5.11.0
diff --git a/dist/changes-5.10.0 b/dist/changes-5.10.0
new file mode 100644
index 0000000..e7365f5
--- /dev/null
+++ b/dist/changes-5.10.0
@@ -0,0 +1,22 @@
+Qt 5.10 introduces many new features and improvements as well as bugfixes
+over the 5.9.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.10 series is binary compatible with the 5.9.x series.
+Applications compiled for 5.9 will continue to run with 5.10.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Qt 5.10.0 Changes *
+****************************************************************************
+
+ - This release contains only minor code improvements.
diff --git a/dist/changes-5.10.1 b/dist/changes-5.10.1
new file mode 100644
index 0000000..695c4e3
--- /dev/null
+++ b/dist/changes-5.10.1
@@ -0,0 +1,26 @@
+Qt 5.10.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.10.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.10 series is binary compatible with the 5.9.x series.
+Applications compiled for 5.9 will continue to run with 5.10.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+This release contains all fixes included in the Qt 5.9.4 release.
+
+****************************************************************************
+* Qt 5.10.1 Changes *
+****************************************************************************
+
+ - This release contains only minor code improvements.
diff --git a/examples/winextras/iconextractor/main.cpp b/examples/winextras/iconextractor/main.cpp
index eb39f9f..d630f9b 100644
--- a/examples/winextras/iconextractor/main.cpp
+++ b/examples/winextras/iconextractor/main.cpp
@@ -141,7 +141,7 @@ static QPixmap pixmapFromShellImageList(int iImageList, const SHFILEINFO &info)
// For MinGW:
static const IID iID_IImageList = {0x46eb5926, 0x582e, 0x4017, {0x9f, 0xdf, 0xe8, 0x99, 0x8d, 0xaa, 0x9, 0x50}};
- IImageList *imageList = Q_NULLPTR;
+ IImageList *imageList = nullptr;
if (FAILED(SHGetImageList(iImageList, iID_IImageList, reinterpret_cast<void **>(&imageList))))
return result;
@@ -237,7 +237,7 @@ static PixmapEntryList extractShellIcons(const QString &sourceFile, bool addOver
}
} // for standardSizeEntryCount
// Windows Vista onwards: extract large/jumbo icons
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA && info.hIcon) {
+ if (info.hIcon) {
const QPixmap extraLarge = pixmapFromShellImageList(sHIL_EXTRALARGE, info);
if (!extraLarge.isNull()) {
PixmapEntry entry;
@@ -265,22 +265,22 @@ static const char description[] =
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
- QCoreApplication::setApplicationName("Icon Extractor");
- QCoreApplication::setOrganizationName("QtProject");
- QCoreApplication::setApplicationVersion(QT_VERSION_STR);
+ QCoreApplication::setApplicationName(QStringLiteral("Icon Extractor"));
+ QCoreApplication::setOrganizationName(QStringLiteral("QtProject"));
+ QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
QCommandLineParser parser;
parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsCompactedShortOptions);
parser.setApplicationDescription(QLatin1String(description));
parser.addHelpOption();
parser.addVersionOption();
- const QCommandLineOption largeIconOption("large", "Extract large icons");
+ const QCommandLineOption largeIconOption(QStringLiteral("large"), QStringLiteral("Extract large icons"));
parser.addOption(largeIconOption);
- const QCommandLineOption shellIconOption("shell", "Extract shell icons using SHGetFileInfo()");
+ const QCommandLineOption shellIconOption(QStringLiteral("shell"), QStringLiteral("Extract shell icons using SHGetFileInfo()"));
parser.addOption(shellIconOption);
- const QCommandLineOption shellOverlayOption("overlay", "Extract shell overlay icons");
+ const QCommandLineOption shellOverlayOption(QStringLiteral("overlay"), QStringLiteral("Extract shell overlay icons"));
parser.addOption(shellOverlayOption);
- parser.addPositionalArgument("file", "The file to open.");
- parser.addPositionalArgument("image file folder", "The folder to store the images.");
+ parser.addPositionalArgument(QStringLiteral("file"), QStringLiteral("The file to open."));
+ parser.addPositionalArgument(QStringLiteral("image file folder"), QStringLiteral("The folder to store the images."));
parser.process(app);
const QStringList &positionalArguments = parser.positionalArguments();
if (positionalArguments.isEmpty())
diff --git a/examples/winextras/musicplayer/main.cpp b/examples/winextras/musicplayer/main.cpp
index 47af77e..9511152 100644
--- a/examples/winextras/musicplayer/main.cpp
+++ b/examples/winextras/musicplayer/main.cpp
@@ -105,7 +105,7 @@ int main(int argc, char *argv[])
QCoreApplication::setApplicationName(QStringLiteral("MusicPlayer"));
QCoreApplication::setApplicationVersion( QLatin1String(QT_VERSION_STR));
QCoreApplication::setOrganizationName(QStringLiteral("QtWinExtras"));
- QCoreApplication::setOrganizationDomain("qt-project.org");
+ QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org"));
QGuiApplication::setApplicationDisplayName(QStringLiteral("QtWinExtras Music Player"));
if (!associateFileTypes())
diff --git a/examples/winextras/musicplayer/musicplayer.cpp b/examples/winextras/musicplayer/musicplayer.cpp
index 7f5422a..12c6854 100644
--- a/examples/winextras/musicplayer/musicplayer.cpp
+++ b/examples/winextras/musicplayer/musicplayer.cpp
@@ -66,8 +66,7 @@ MusicPlayer::MusicPlayer(QWidget *parent) : QWidget(parent)
connect(&mediaPlayer, &QMediaPlayer::durationChanged, this, &MusicPlayer::updateDuration);
connect(&mediaPlayer, &QMediaObject::metaDataAvailableChanged, this, &MusicPlayer::updateInfo);
- typedef void(QMediaPlayer::*ErrorSignal)(QMediaPlayer::Error);
- connect(&mediaPlayer, static_cast<ErrorSignal>(&QMediaPlayer::error),
+ connect(&mediaPlayer, QOverload<QMediaPlayer::Error>::of(&QMediaPlayer::error),
this, &MusicPlayer::handleError);
connect(&mediaPlayer, &QMediaPlayer::stateChanged,
this, &MusicPlayer::updateState);
@@ -183,17 +182,20 @@ void MusicPlayer::mouseReleaseEvent(QMouseEvent *event)
//! [1]
void MusicPlayer::stylize()
{
- if (QtWin::isCompositionEnabled()) {
- QtWin::extendFrameIntoClientArea(this, -1, -1, -1, -1);
- setAttribute(Qt::WA_TranslucentBackground, true);
- setAttribute(Qt::WA_NoSystemBackground, false);
- setStyleSheet(QStringLiteral("MusicPlayer { background: transparent; }"));
- } else {
- QtWin::resetExtendedFrame(this);
- setAttribute(Qt::WA_TranslucentBackground, false);
- setStyleSheet(QStringLiteral("MusicPlayer { background: %1; }").arg(QtWin::realColorizationColor().name()));
+ if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8) {
+ // Set styling options relevant only to Windows 7.
+ if (QtWin::isCompositionEnabled()) {
+ QtWin::extendFrameIntoClientArea(this, -1, -1, -1, -1);
+ setAttribute(Qt::WA_TranslucentBackground, true);
+ setAttribute(Qt::WA_NoSystemBackground, false);
+ setStyleSheet(QStringLiteral("MusicPlayer { background: transparent; }"));
+ } else {
+ QtWin::resetExtendedFrame(this);
+ setAttribute(Qt::WA_TranslucentBackground, false);
+ setStyleSheet(QStringLiteral("MusicPlayer { background: %1; }").arg(QtWin::realColorizationColor().name()));
+ }
+ volumeButton->stylize();
}
- volumeButton->stylize();
}
//! [1]
diff --git a/examples/winextras/musicplayer/volumebutton.cpp b/examples/winextras/musicplayer/volumebutton.cpp
index 4ad5e1a..9cecf08 100644
--- a/examples/winextras/musicplayer/volumebutton.cpp
+++ b/examples/winextras/musicplayer/volumebutton.cpp
@@ -70,8 +70,7 @@ VolumeButton::VolumeButton(QWidget *parent) :
label->setNum(100);
label->setMinimumWidth(label->sizeHint().width());
- typedef void(QLabel::*IntSlot)(int);
- connect(slider, &QAbstractSlider::valueChanged, label, static_cast<IntSlot>(&QLabel::setNum));
+ connect(slider, &QAbstractSlider::valueChanged, label, QOverload<int>::of(&QLabel::setNum));
QBoxLayout *popupLayout = new QHBoxLayout(popup);
popupLayout->setMargin(2);
@@ -111,14 +110,17 @@ void VolumeButton::setVolume(int volume)
//! [0]
void VolumeButton::stylize()
{
- if (QtWin::isCompositionEnabled()) {
- QtWin::enableBlurBehindWindow(menu);
- QString css("QMenu { border: 1px solid %1; border-radius: 2px; background: transparent; }");
- menu->setStyleSheet(css.arg(QtWin::realColorizationColor().name()));
- } else {
- QtWin::disableBlurBehindWindow(menu);
- QString css("QMenu { border: 1px solid black; background: %1; }");
- menu->setStyleSheet(css.arg(QtWin::realColorizationColor().name()));
+ if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8) {
+ // Set styling options relevant only to Windows 7.
+ if (QtWin::isCompositionEnabled()) {
+ QtWin::enableBlurBehindWindow(menu);
+ QString css("QMenu { border: 1px solid %1; border-radius: 2px; background: transparent; }");
+ menu->setStyleSheet(css.arg(QtWin::realColorizationColor().name()));
+ } else {
+ QtWin::disableBlurBehindWindow(menu);
+ QString css("QMenu { border: 1px solid black; background: %1; }");
+ menu->setStyleSheet(css.arg(QtWin::realColorizationColor().name()));
+ }
}
}
//! [0]
diff --git a/examples/winextras/quickplayer/main.cpp b/examples/winextras/quickplayer/main.cpp
index 87e3e3d..caf3a01 100644
--- a/examples/winextras/quickplayer/main.cpp
+++ b/examples/winextras/quickplayer/main.cpp
@@ -50,6 +50,8 @@
#include <QQmlApplicationEngine>
#include <QGuiApplication>
+#include <QCommandLineParser>
+#include <QCommandLineOption>
#include <QWindow>
#include <QQmlContext>
#include <QStandardPaths>
@@ -57,21 +59,32 @@
int main(int argc, char *argv[])
{
+ QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
- app.setApplicationName("QuickPlayer");
- app.setOrganizationName("QtWinExtras");
- app.setOrganizationDomain("qt-project.org");
- app.setApplicationDisplayName("QtWinExtras Quick Player");
+ QCoreApplication::setApplicationName(QStringLiteral("QuickPlayer"));
+ QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
+ QCoreApplication::setOrganizationName(QStringLiteral("QtWinExtras"));
+ QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org"));
+ QGuiApplication::setApplicationDisplayName(QStringLiteral("QtWinExtras Quick Player"));
QQmlApplicationEngine engine;
const QStringList musicPaths = QStandardPaths::standardLocations(QStandardPaths::MusicLocation);
const QUrl musicUrl = QUrl::fromLocalFile(musicPaths.isEmpty() ? QDir::homePath() : musicPaths.first());
engine.rootContext()->setContextProperty(QStringLiteral("musicUrl"), musicUrl);
- const QStringList arguments = QCoreApplication::arguments();
- const QUrl commandLineUrl = arguments.size() > 1 ? QUrl::fromLocalFile(arguments.at(1)) : QUrl();
+
+ QCommandLineParser parser;
+ parser.setApplicationDescription(QGuiApplication::applicationDisplayName());
+ parser.addHelpOption();
+ parser.addVersionOption();
+ parser.addPositionalArgument(QStringLiteral("url"), QStringLiteral("The URL to open."));
+ parser.process(app);
+ QUrl commandLineUrl;
+ if (!parser.positionalArguments().isEmpty())
+ commandLineUrl = QUrl::fromUserInput(parser.positionalArguments().constFirst(), QDir::currentPath(), QUrl::AssumeLocalFile);
engine.rootContext()->setContextProperty(QStringLiteral("url"), commandLineUrl);
- engine.load(QUrl("qrc:/main.qml"));
- QObject* root = engine.rootObjects().value(0);
+
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ QObject *root = engine.rootObjects().value(0);
if (QWindow *window = qobject_cast<QWindow *>(root))
window->show();
else
diff --git a/src/winextras/qwineventfilter.cpp b/src/winextras/qwineventfilter.cpp
index 6b31e71..4ec3bdc 100644
--- a/src/winextras/qwineventfilter.cpp
+++ b/src/winextras/qwineventfilter.cpp
@@ -118,5 +118,5 @@ QWindow *QWinEventFilter::findWindow(HWND handle)
if (topLevel->handle() && topLevel->winId() == wid)
return topLevel;
}
- return Q_NULLPTR;
+ return nullptr;
}
diff --git a/src/winextras/qwinfunctions.cpp b/src/winextras/qwinfunctions.cpp
index 692bcb0..7b102a8 100644
--- a/src/winextras/qwinfunctions.cpp
+++ b/src/winextras/qwinfunctions.cpp
@@ -38,6 +38,13 @@
**
****************************************************************************/
+#if defined(NTDDI_VERSION) && NTDDI_VERSION < 0x06010000 // NTDDI_WIN7
+# undef NTDDI_VERSION
+#endif
+#if !defined(NTDDI_VERSION)
+# define NTDDI_VERSION 0x06010000 // Enable functions for MinGW
+#endif
+
#include "qwinfunctions.h"
#include "qwinfunctions_p.h"
#include "qwineventfilter_p.h"
@@ -169,15 +176,15 @@ HRGN qt_RectToHRGN(const QRect &rc)
*/
HRGN QtWin::toHRGN(const QRegion &region)
{
- if (region.isNull() || region.rectCount() == 0) {
+ const int size = region.rectCount();
+ if (size == 0)
return 0;
- }
+
HRGN resultRgn = 0;
- QVector<QRect> rects = region.rects();
- resultRgn = qt_RectToHRGN(rects.at(0));
- const int size = rects.size();
+ const auto rects = region.begin();
+ resultRgn = qt_RectToHRGN(rects[0]);
for (int i = 1; i < size; i++) {
- HRGN tmpRgn = qt_RectToHRGN(rects.at(i));
+ HRGN tmpRgn = qt_RectToHRGN(rects[i]);
int err = CombineRgn(resultRgn, resultRgn, tmpRgn, RGN_OR);
if (err == ERROR)
qWarning("Error combining HRGNs.");
@@ -1812,11 +1819,8 @@ bool QtWin::isCompositionOpaque()
*/
void QtWin::setCurrentProcessExplicitAppUserModelID(const QString &id)
{
- qtShell32Dll.init();
- if (qtShell32Dll.setCurrentProcessExplicitAppUserModelID) {
- QScopedArrayPointer<wchar_t> wid(qt_qstringToNullTerminated(id));
- qtShell32Dll.setCurrentProcessExplicitAppUserModelID(wid.data());
- }
+ QScopedArrayPointer<wchar_t> wid(qt_qstringToNullTerminated(id));
+ SetCurrentProcessExplicitAppUserModelID(wid.data());
}
/*!
diff --git a/src/winextras/qwinfunctions.h b/src/winextras/qwinfunctions.h
index 7190258..bc07401 100644
--- a/src/winextras/qwinfunctions.h
+++ b/src/winextras/qwinfunctions.h
@@ -89,7 +89,7 @@ namespace QtWin
Q_WINEXTRAS_EXPORT QString stringFromHresult(HRESULT hresult);
Q_WINEXTRAS_EXPORT QString errorStringFromHresult(HRESULT hresult);
- Q_WINEXTRAS_EXPORT QColor colorizationColor(bool *opaqueBlend = Q_NULLPTR);
+ Q_WINEXTRAS_EXPORT QColor colorizationColor(bool *opaqueBlend = nullptr);
Q_WINEXTRAS_EXPORT QColor realColorizationColor();
Q_WINEXTRAS_EXPORT void setWindowExcludedFromPeek(QWindow *window, bool exclude);
diff --git a/src/winextras/qwinfunctions_p.cpp b/src/winextras/qwinfunctions_p.cpp
deleted file mode 100644
index ea9dcf9..0000000
--- a/src/winextras/qwinfunctions_p.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com>
- ** Contact: https://www.qt.io/licensing/
- **
- ** This file is part of the QtWinExtras module of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and The Qt Company. For licensing terms
- ** and conditions see https://www.qt.io/terms-conditions. For further
- ** information use the contact form at https://www.qt.io/contact-us.
- **
- ** GNU Lesser General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 3 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL3 included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 3 requirements
- ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 2.0 or (at your option) the GNU General
- ** Public license version 3 or any later version approved by the KDE Free
- ** Qt Foundation. The licenses are as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
- ** included in the packaging of this file. Please review the following
- ** information to ensure the GNU General Public License requirements will
- ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
- ** https://www.gnu.org/licenses/gpl-3.0.html.
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "qwinfunctions_p.h"
-
-#include <qt_windows.h>
-
-QT_BEGIN_NAMESPACE
-
-// in order to allow binary to load on WinXP...
-QtDwmApiDll qtDwmApiDll;
-QtShell32Dll qtShell32Dll;
-
-void QtDwmApiDll::resolve()
-{
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
- if (const HMODULE dwmapi = LoadLibraryW(L"dwmapi.dll")) {
- dwmSetIconicThumbnail =
- (DwmSetIconicThumbnail) GetProcAddress(dwmapi, "DwmSetIconicThumbnail");
- dwmSetIconicLivePreviewBitmap =
- (DwmSetIconicLivePreviewBitmap) GetProcAddress(dwmapi, "DwmSetIconicLivePreviewBitmap");
- dwmInvalidateIconicBitmaps =
- (DwmInvalidateIconicBitmaps) GetProcAddress(dwmapi, "DwmInvalidateIconicBitmaps");
- }
- }
-}
-
-void QtShell32Dll::resolve()
-{
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
- if (const HMODULE shell32 = LoadLibraryW(L"shell32.dll")) {
- setCurrentProcessExplicitAppUserModelID =
- (SetCurrentProcessExplicitAppUserModelID) GetProcAddress(shell32, "SetCurrentProcessExplicitAppUserModelID");
- }
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/winextras/qwinfunctions_p.h b/src/winextras/qwinfunctions_p.h
index 6ea1598..a69e52c 100644
--- a/src/winextras/qwinfunctions_p.h
+++ b/src/winextras/qwinfunctions_p.h
@@ -64,20 +64,8 @@ enum qt_DWMWINDOWATTRIBUTE // Not present in MinGW 4.9
qt_DWMWA_EXCLUDED_FROM_PEEK = 12,
};
-struct QtDwmApiDll
+namespace QtDwmApiDll
{
- typedef HRESULT (STDAPICALLTYPE *DwmSetIconicThumbnail)(HWND, HBITMAP, DWORD); // Windows 7
- typedef HRESULT (STDAPICALLTYPE *DwmSetIconicLivePreviewBitmap)(HWND, HBITMAP, POINT *, DWORD);
- typedef HRESULT (STDAPICALLTYPE *DwmInvalidateIconicBitmaps)(HWND);
-
- void init()
- {
- if (!dwmSetIconicThumbnail)
- resolve();
- }
-
- void resolve();
-
template <class T> static T windowAttribute(HWND hwnd, DWORD attribute, T defaultValue);
template <class T> static void setWindowAttribute(HWND hwnd, DWORD attribute, T value);
@@ -86,30 +74,8 @@ struct QtDwmApiDll
static void setBooleanWindowAttribute(HWND hwnd, DWORD attribute, bool value)
{ setWindowAttribute<BOOL>(hwnd, attribute, BOOL(value ? TRUE : FALSE)); }
-
- DwmSetIconicThumbnail dwmSetIconicThumbnail = nullptr;
- DwmSetIconicLivePreviewBitmap dwmSetIconicLivePreviewBitmap = nullptr;
- DwmInvalidateIconicBitmaps dwmInvalidateIconicBitmaps = nullptr;
};
-struct QtShell32Dll
-{
- typedef HRESULT (STDAPICALLTYPE *SetCurrentProcessExplicitAppUserModelID)(PCWSTR);
-
- void init()
- {
- if (!setCurrentProcessExplicitAppUserModelID)
- resolve();
- }
-
- void resolve();
-
- SetCurrentProcessExplicitAppUserModelID setCurrentProcessExplicitAppUserModelID = nullptr; // Windows 7
-};
-
-extern QtDwmApiDll qtDwmApiDll;
-extern QtShell32Dll qtShell32Dll;
-
inline void qt_qstringToNullTerminated(const QString &src, wchar_t *dst)
{
dst[src.toWCharArray(dst)] = 0;
diff --git a/src/winextras/qwinjumplist.h b/src/winextras/qwinjumplist.h
index 3900998..b4807dd 100644
--- a/src/winextras/qwinjumplist.h
+++ b/src/winextras/qwinjumplist.h
@@ -58,7 +58,7 @@ class Q_WINEXTRAS_EXPORT QWinJumpList : public QObject
Q_PROPERTY(QString identifier READ identifier WRITE setIdentifier)
public:
- explicit QWinJumpList(QObject *parent = Q_NULLPTR);
+ explicit QWinJumpList(QObject *parent = nullptr);
~QWinJumpList();
QString identifier() const;
diff --git a/src/winextras/qwintaskbarbutton.cpp b/src/winextras/qwintaskbarbutton.cpp
index f687f68..cedca35 100644
--- a/src/winextras/qwintaskbarbutton.cpp
+++ b/src/winextras/qwintaskbarbutton.cpp
@@ -166,7 +166,7 @@ void QWinTaskbarButtonPrivate::_q_updateProgress()
const int max = progressBar->maximum();
const int range = max - min;
if (range > 0) {
- const int value = 100 * (progressBar->value() - min) / range;
+ const int value = qRound(double(100) * (double(progressBar->value() - min)) / double(range));
pTbList->SetProgressValue(handle(), ULONGLONG(value), 100);
}
}
diff --git a/src/winextras/qwintaskbarbutton.h b/src/winextras/qwintaskbarbutton.h
index 4685744..dc4d469 100644
--- a/src/winextras/qwintaskbarbutton.h
+++ b/src/winextras/qwintaskbarbutton.h
@@ -59,7 +59,7 @@ class Q_WINEXTRAS_EXPORT QWinTaskbarButton : public QObject
Q_PROPERTY(QWindow *window READ window WRITE setWindow)
public:
- explicit QWinTaskbarButton(QObject *parent = Q_NULLPTR);
+ explicit QWinTaskbarButton(QObject *parent = nullptr);
~QWinTaskbarButton();
void setWindow(QWindow *window);
diff --git a/src/winextras/qwintaskbarprogress.h b/src/winextras/qwintaskbarprogress.h
index 6b31eef..ca64046 100644
--- a/src/winextras/qwintaskbarprogress.h
+++ b/src/winextras/qwintaskbarprogress.h
@@ -59,7 +59,7 @@ class Q_WINEXTRAS_EXPORT QWinTaskbarProgress : public QObject
Q_PROPERTY(bool stopped READ isStopped NOTIFY stoppedChanged)
public:
- explicit QWinTaskbarProgress(QObject *parent = Q_NULLPTR);
+ explicit QWinTaskbarProgress(QObject *parent = nullptr);
~QWinTaskbarProgress();
int value() const;
diff --git a/src/winextras/qwinthumbnailtoolbar.cpp b/src/winextras/qwinthumbnailtoolbar.cpp
index d7e4ced..39622d1 100644
--- a/src/winextras/qwinthumbnailtoolbar.cpp
+++ b/src/winextras/qwinthumbnailtoolbar.cpp
@@ -38,6 +38,13 @@
**
****************************************************************************/
+#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0601
+# undef _WIN32_WINNT
+#endif
+#if !defined(_WIN32_WINNT)
+# define _WIN32_WINNT 0x0601 // Enable functions for MinGW
+#endif
+
#include "qwinthumbnailtoolbar.h"
#include "qwinthumbnailtoolbar_p.h"
#include "qwinthumbnailtoolbutton.h"
@@ -228,18 +235,15 @@ int QWinThumbnailToolBar::count() const
void QWinThumbnailToolBarPrivate::updateIconicPixmapsEnabled(bool invalidate)
{
Q_Q(QWinThumbnailToolBar);
- qtDwmApiDll.init();
const HWND hwnd = handle();
if (!hwnd) {
qWarning() << Q_FUNC_INFO << "invoked with hwnd=0";
return;
}
- if (!qtDwmApiDll.dwmInvalidateIconicBitmaps)
- return;
const bool enabled = iconicThumbnail || iconicLivePreview;
q->setIconicPixmapNotificationsEnabled(enabled);
if (enabled && invalidate) {
- const HRESULT hr = qtDwmApiDll.dwmInvalidateIconicBitmaps(hwnd);
+ const HRESULT hr = DwmInvalidateIconicBitmaps(hwnd);
if (FAILED(hr))
qWarning() << QWinThumbnailToolBarPrivate::msgComFailed("DwmInvalidateIconicBitmaps", hr);
}
@@ -385,12 +389,11 @@ QPixmap QWinThumbnailToolBar::iconicLivePreviewPixmap() const
inline void QWinThumbnailToolBarPrivate::updateIconicThumbnail(const MSG *message)
{
- qtDwmApiDll.init();
- if (!qtDwmApiDll.dwmSetIconicThumbnail || !iconicThumbnail)
+ if (!iconicThumbnail)
return;
const QSize maxSize(HIWORD(message->lParam), LOWORD(message->lParam));
if (const HBITMAP bitmap = iconicThumbnail.bitmap(maxSize)) {
- const HRESULT hr = qtDwmApiDll.dwmSetIconicThumbnail(message->hwnd, bitmap, dWM_SIT_DISPLAYFRAME);
+ const HRESULT hr = DwmSetIconicThumbnail(message->hwnd, bitmap, dWM_SIT_DISPLAYFRAME);
if (FAILED(hr))
qWarning() << QWinThumbnailToolBarPrivate::msgComFailed("DwmSetIconicThumbnail", hr);
}
@@ -398,15 +401,14 @@ inline void QWinThumbnailToolBarPrivate::updateIconicThumbnail(const MSG *messag
inline void QWinThumbnailToolBarPrivate::updateIconicLivePreview(const MSG *message)
{
- qtDwmApiDll.init();
- if (!qtDwmApiDll.dwmSetIconicLivePreviewBitmap || !iconicLivePreview)
+ if (!iconicLivePreview)
return;
RECT rect;
GetClientRect(message->hwnd, &rect);
const QSize maxSize(rect.right, rect.bottom);
POINT offset = {0, 0};
if (const HBITMAP bitmap = iconicLivePreview.bitmap(maxSize)) {
- const HRESULT hr = qtDwmApiDll.dwmSetIconicLivePreviewBitmap(message->hwnd, bitmap, &offset, dWM_SIT_DISPLAYFRAME);
+ const HRESULT hr = DwmSetIconicLivePreviewBitmap(message->hwnd, bitmap, &offset, dWM_SIT_DISPLAYFRAME);
if (FAILED(hr))
qWarning() << QWinThumbnailToolBarPrivate::msgComFailed("DwmSetIconicLivePreviewBitmap", hr);
}
@@ -468,7 +470,6 @@ inline HWND QWinThumbnailToolBarPrivate::handle() const
void QWinThumbnailToolBarPrivate::initToolbar()
{
-#if !defined(_MSC_VER) || _MSC_VER >= 1600
if (!pTbList || !window)
return;
THUMBBUTTON buttons[windowsLimitedThumbbarSize];
@@ -476,10 +477,6 @@ void QWinThumbnailToolBarPrivate::initToolbar()
HRESULT hresult = pTbList->ThumbBarAddButtons(handle(), windowsLimitedThumbbarSize, buttons);
if (FAILED(hresult))
qWarning() << msgComFailed("ThumbBarAddButtons", hresult);
-#else
- // ITaskbarList3::ThumbBarAddButtons() has a different signature in SDK 6.X
- Q_UNIMPLEMENTED();
-#endif
}
void QWinThumbnailToolBarPrivate::clearToolbar()
diff --git a/src/winextras/qwinthumbnailtoolbar.h b/src/winextras/qwinthumbnailtoolbar.h
index 4c98c70..83e2f2b 100644
--- a/src/winextras/qwinthumbnailtoolbar.h
+++ b/src/winextras/qwinthumbnailtoolbar.h
@@ -61,7 +61,7 @@ class Q_WINEXTRAS_EXPORT QWinThumbnailToolBar : public QObject
Q_PROPERTY(QPixmap iconicLivePreviewPixmap READ iconicLivePreviewPixmap WRITE setIconicLivePreviewPixmap)
public:
- explicit QWinThumbnailToolBar(QObject *parent = Q_NULLPTR);
+ explicit QWinThumbnailToolBar(QObject *parent = nullptr);
~QWinThumbnailToolBar();
void setWindow(QWindow *window);
diff --git a/src/winextras/qwinthumbnailtoolbutton.h b/src/winextras/qwinthumbnailtoolbutton.h
index 6a14894..0ab970f 100644
--- a/src/winextras/qwinthumbnailtoolbutton.h
+++ b/src/winextras/qwinthumbnailtoolbutton.h
@@ -61,7 +61,7 @@ class Q_WINEXTRAS_EXPORT QWinThumbnailToolButton : public QObject
Q_PROPERTY(bool flat READ isFlat WRITE setFlat)
public:
- explicit QWinThumbnailToolButton(QObject *parent = Q_NULLPTR);
+ explicit QWinThumbnailToolButton(QObject *parent = nullptr);
~QWinThumbnailToolButton();
void setToolTip(const QString &toolTip);
diff --git a/src/winextras/winextras.pro b/src/winextras/winextras.pro
index 5d93c6b..705c48c 100644
--- a/src/winextras/winextras.pro
+++ b/src/winextras/winextras.pro
@@ -6,7 +6,6 @@ DEFINES += QT_NO_FOREACH
SOURCES += \
qwinfunctions.cpp \
- qwinfunctions_p.cpp \
qwintaskbarbutton.cpp \
qwintaskbarprogress.cpp \
windowsguidsdefs.cpp \
diff --git a/src/winextras/winshobjidl_p.h b/src/winextras/winshobjidl_p.h
index 93abea0..efd28c6 100644
--- a/src/winextras/winshobjidl_p.h
+++ b/src/winextras/winshobjidl_p.h
@@ -229,7 +229,7 @@ public:
#endif
-#if (defined _MSC_VER && _MSC_VER < 1600) || defined(Q_CC_MINGW)
+#ifdef Q_CC_MINGW
# if !defined(__MINGW64_VERSION_MAJOR) || !defined(__MINGW64_VERSION_MINOR) || __MINGW64_VERSION_MAJOR * 100 + __MINGW64_VERSION_MINOR < 301
diff --git a/tests/auto/qwinjumplist/tst_qwinjumplist.cpp b/tests/auto/qwinjumplist/tst_qwinjumplist.cpp
index 26f382e..40d6b04 100644
--- a/tests/auto/qwinjumplist/tst_qwinjumplist.cpp
+++ b/tests/auto/qwinjumplist/tst_qwinjumplist.cpp
@@ -30,6 +30,7 @@
#include <QWinJumpList>
#include <QWinJumpListItem>
#include <QWinJumpListCategory>
+#include <QOperatingSystemVersion>
Q_DECLARE_METATYPE(QWinJumpListItem::Type)
@@ -55,7 +56,7 @@ static inline QByteArray msgFileNameMismatch(const QString &f1, const QString &f
void tst_QWinJumpList::testRecent()
{
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8_1)
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8_1)
QSKIP("QTBUG-48751: Recent items do not work on Windows 8.1 or 10", Continue);
QScopedPointer<QWinJumpList> jumplist(new QWinJumpList);
QWinJumpListCategory *recent1 = jumplist->recent();
@@ -104,7 +105,7 @@ void tst_QWinJumpList::testRecent()
void tst_QWinJumpList::testFrequent()
{
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8_1)
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8_1)
QSKIP("QTBUG-48751: Frequent items do not work on Windows 8.1 or 10", Continue);
QScopedPointer<QWinJumpList> jumplist(new QWinJumpList);
QWinJumpListCategory *frequent1 = jumplist->frequent();
diff --git a/tests/manual/jumplist/testwidget.h b/tests/manual/jumplist/testwidget.h
index 61ca4c6..0cae1ea 100644
--- a/tests/manual/jumplist/testwidget.h
+++ b/tests/manual/jumplist/testwidget.h
@@ -46,7 +46,7 @@ class TestWidget : public QMainWindow
Q_OBJECT
public:
- explicit TestWidget(QWidget *parent = Q_NULLPTR);
+ explicit TestWidget(QWidget *parent = nullptr);
~TestWidget();
void showFile(const QString &path);