diff options
author | Liang Qi <liang.qi@qt.io> | 2016-06-20 14:09:00 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-06-21 08:39:41 +0200 |
commit | ea438b2508f329698e11c6dae6994d441c6e67df (patch) | |
tree | 7a6052b98ba1ff6e0258c52cfc2726e197f53dd2 /src/widgets/util/qsystemtrayicon_win.cpp | |
parent | a2f319e9fb2f7595fc16d0d79e26438463051a53 (diff) | |
parent | 5f0ec7305e4310123ddeb98d3523087e3c560d9c (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
src/corelib/global/qglobal.cpp
src/corelib/global/qsysinfo.h
src/corelib/kernel/qcoreapplication_win.cpp
src/gui/text/qdistancefield.cpp
src/gui/text/qdistancefield_p.h
src/plugins/platforms/windows/qwindowsglcontext.cpp
src/plugins/platforms/windows/qwindowsglcontext.h
Change-Id: Ib3500acc2b28553bde06758cd9a2e19eb7fe2978
Diffstat (limited to 'src/widgets/util/qsystemtrayicon_win.cpp')
-rw-r--r-- | src/widgets/util/qsystemtrayicon_win.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp index 3acf1fa777..2da24e482b 100644 --- a/src/widgets/util/qsystemtrayicon_win.cpp +++ b/src/widgets/util/qsystemtrayicon_win.cpp @@ -237,22 +237,9 @@ void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd) qStringToLimitedWCharArray(tip, tnd.szTip, sizeof(tnd.szTip)/sizeof(wchar_t)); } -static int iconFlag( QSystemTrayIcon::MessageIcon icon ) -{ - switch (icon) { - case QSystemTrayIcon::Information: - return NIIF_INFO; - case QSystemTrayIcon::Warning: - return NIIF_WARNING; - case QSystemTrayIcon::Critical: - return NIIF_ERROR; - case QSystemTrayIcon::NoIcon: - return NIIF_NONE; - default: - Q_ASSERT_X(false, "QSystemTrayIconSys::showMessage", "Invalid QSystemTrayIcon::MessageIcon value"); - return NIIF_NONE; - } -} +#ifndef NIIF_LARGE_ICON +# define NIIF_LARGE_ICON 0x00000020 +#endif bool QSystemTrayIconSys::showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs) { @@ -262,7 +249,22 @@ bool QSystemTrayIconSys::showMessage(const QString &title, const QString &messag qStringToLimitedWCharArray(title, tnd.szInfoTitle, 64); tnd.uID = q_uNOTIFYICONID; - tnd.dwInfoFlags = iconFlag(type); + switch (type) { + case QSystemTrayIcon::Information: + tnd.dwInfoFlags = NIIF_INFO; + break; + case QSystemTrayIcon::Warning: + tnd.dwInfoFlags = NIIF_WARNING; + break; + case QSystemTrayIcon::Critical: + tnd.dwInfoFlags = NIIF_ERROR; + break; + case QSystemTrayIcon::NoIcon: + tnd.dwInfoFlags = hIcon ? NIIF_USER : NIIF_NONE; + break; + } + if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) + tnd.dwInfoFlags |= NIIF_LARGE_ICON; tnd.cbSize = notifyIconSize; tnd.hWnd = m_hwnd; tnd.uTimeout = uSecs; @@ -303,9 +305,10 @@ HICON QSystemTrayIconSys::createIcon() const QIcon icon = q->icon(); if (icon.isNull()) return oldIcon; - const int iconSizeX = GetSystemMetrics(SM_CXSMICON); - const int iconSizeY = GetSystemMetrics(SM_CYSMICON); - const QSize size = icon.actualSize(QSize(iconSizeX, iconSizeY)); + const QSize requestedSize = QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA + ? QSize(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)) + : QSize(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); + const QSize size = icon.actualSize(requestedSize); const QPixmap pm = icon.pixmap(size); if (pm.isNull()) return oldIcon; |