summaryrefslogtreecommitdiffstats
path: root/src/widgets/util
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-18 09:29:17 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-20 08:00:26 +0200
commite32f1a4d61f0c55d066a43657ad607131be8ca34 (patch)
tree81ea388722187e1650b2c2b2d9c22eafae5c0527 /src/widgets/util
parentfdb956a3ede6cb0a25112c1e1af6c93fd2051de1 (diff)
parentee2eed350f95285b65e3dd9647e5f366e16fd5a4 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
And blacklisted a few tests in tst_QUdpSocket. Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtNative.java src/corelib/global/qglobal.cpp src/corelib/global/qsystemdetection.h src/corelib/io/qfileselector.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp tests/auto/network/socket/qudpsocket/BLACKLIST Task-number: QTBUG-54205 Change-Id: I11dd1c90186eb1b847d45be87a26041f61d89ef6
Diffstat (limited to 'src/widgets/util')
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp43
1 files changed, 23 insertions, 20 deletions
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index f34714c016..7cbf979901 100644
--- a/src/widgets/util/qsystemtrayicon_win.cpp
+++ b/src/widgets/util/qsystemtrayicon_win.cpp
@@ -236,22 +236,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)
{
@@ -261,7 +248,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;
@@ -302,9 +304,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;