summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowstheme.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2016-07-19 19:51:41 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2016-07-19 20:14:40 +0200
commit782ebeada125e3d8a293c7806e34cc737c30ddda (patch)
tree5516ad24a7532d650289758abd5e92a35bc2240e /src/plugins/platforms/windows/qwindowstheme.cpp
parent091df96fb8da356dc9de81dc390f55e66d4d7c01 (diff)
parent62cbb434579a56871f0917bc306d592055381c00 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: qmake/library/qmakebuiltins.cpp qmake/library/qmakeevaluator.cpp qmake/library/qmakeevaluator.h qmake/project.h QMakeEvaluator: * evaluateConditional(): one side changed return type, the other changed a parameter type. * split_value_list(): one side changed a parameter adjacent to where ... * expandVariableReferences(): ... the other killed one overload and changed the survivor src/corelib/io/qlockfile_unix.cpp One side changed a #if condition, the other moved NETBSD's part of what it controlled. src/corelib/tools/qdatetime.cpp One side fixed a reachable Q_UNREACHABLE in toMSecsSinceEpoch(), the other moved it from the private class to the public one, in the midst of the "short date-time" optimization, which confused diff entirely. One side changed a QStringLiteral to QLatin1String, the other rewrote adjoining code. src/network/kernel/qauthenticator.cpp Both rewrote a line, equivalently; kept the dev version. src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h One side changed #if-ery that the other removed. tools/configure/configureapp.cpp One side added a check to -target parsing; the other killed -target. tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml tests/auto/testlib/selftests/expected_cmptest.xunitxml Regenerated using generate_expected_output.py I note that quite a few other expected_* come out changed, now. There was no git-conflict in src/widgets/kernel/qformlayout.cpp but it didn't compile; one side removed some unused methods; the other found uses for one of them. Put FixedColumnMatrix<>::removeRow(int) back for its new user. Change-Id: I8cc2a71add48c0a848e13cfc47b5a7754e8ca584
Diffstat (limited to 'src/plugins/platforms/windows/qwindowstheme.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp51
1 files changed, 38 insertions, 13 deletions
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index 6c6eb42d63..ff556caeaf 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -319,6 +319,7 @@ QWindowsTheme::QWindowsTheme()
std::fill(m_fonts, m_fonts + NFonts, static_cast<QFont *>(0));
std::fill(m_palettes, m_palettes + NPalettes, static_cast<QPalette *>(0));
refresh();
+ refreshIconPixmapSizes();
}
QWindowsTheme::~QWindowsTheme()
@@ -330,7 +331,7 @@ QWindowsTheme::~QWindowsTheme()
static inline QStringList iconThemeSearchPaths()
{
- const QFileInfo appDir(QCoreApplication::applicationDirPath() + QStringLiteral("/icons"));
+ const QFileInfo appDir(QCoreApplication::applicationDirPath() + QLatin1String("/icons"));
return appDir.isDir() ? QStringList(appDir.absoluteFilePath()) : QStringList();
}
@@ -382,16 +383,8 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const
return QVariant(int(WindowsKeyboardScheme));
case UiEffects:
return QVariant(uiEffects());
- case IconPixmapSizes: {
- QList<int> sizes;
- sizes << 16 << 32;
-#ifdef USE_IIMAGELIST
- sizes << 48; // sHIL_EXTRALARGE
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
- sizes << 256; // SHIL_JUMBO
-#endif // USE_IIMAGELIST
- return QVariant::fromValue(sizes);
- }
+ case IconPixmapSizes:
+ return m_fileIconSizes;
case DialogSnapToDefaultButton:
return QVariant(booleanSystemParametersInfo(SPI_GETSNAPTODEFBUTTON, false));
case ContextMenuOnMouseRelease:
@@ -459,6 +452,15 @@ void QWindowsTheme::refreshFonts()
m_fonts[FixedFont] = new QFont(fixedFont);
}
+enum FileIconSize {
+ // Standard icons obtainable via shGetFileInfo(), SHGFI_SMALLICON, SHGFI_LARGEICON
+ SmallFileIcon, LargeFileIcon,
+ // Larger icons obtainable via SHGetImageList()
+ ExtraLargeFileIcon,
+ JumboFileIcon, // Vista onwards
+ FileIconSizeCount
+};
+
bool QWindowsTheme::usePlatformNativeDialog(DialogType type) const
{
return QWindowsDialogs::useHelper(type);
@@ -475,6 +477,27 @@ void QWindowsTheme::windowsThemeChanged(QWindow * window)
QWindowSystemInterface::handleThemeChange(window);
}
+static int fileIconSizes[FileIconSizeCount];
+
+void QWindowsTheme::refreshIconPixmapSizes()
+{
+ // Standard sizes: 16, 32, 48, 256
+ fileIconSizes[SmallFileIcon] = GetSystemMetrics(SM_CXSMICON); // corresponds to SHGFI_SMALLICON);
+ fileIconSizes[LargeFileIcon] = GetSystemMetrics(SM_CXICON); // corresponds to SHGFI_LARGEICON
+ fileIconSizes[ExtraLargeFileIcon] =
+ fileIconSizes[LargeFileIcon] + fileIconSizes[LargeFileIcon] / 2;
+ fileIconSizes[JumboFileIcon] = 8 * fileIconSizes[LargeFileIcon]; // empirical, has not been observed to work
+ QList<int> sizes;
+ sizes << fileIconSizes[SmallFileIcon] << fileIconSizes[LargeFileIcon];
+#ifdef USE_IIMAGELIST
+ sizes << fileIconSizes[ExtraLargeFileIcon]; // sHIL_EXTRALARGE
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
+ sizes << fileIconSizes[JumboFileIcon]; // SHIL_JUMBO
+#endif // USE_IIMAGELIST
+ qCDebug(lcQpaWindows) << __FUNCTION__ << sizes;
+ m_fileIconSizes = QVariant::fromValue(sizes);
+}
+
// Defined in qpixmap_win.cpp
Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon);
@@ -702,10 +725,12 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s
QPixmap pixmap;
const QString filePath = QDir::toNativeSeparators(fileInfo.filePath());
const int width = int(size.width());
- const int iconSize = width > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON;
+ const int iconSize = width > fileIconSizes[SmallFileIcon] ? SHGFI_LARGEICON : SHGFI_SMALLICON;
const int requestedImageListSize =
#ifdef USE_IIMAGELIST
- width > 48 ? sHIL_JUMBO : (width > 32 ? sHIL_EXTRALARGE : 0);
+ width > fileIconSizes[ExtraLargeFileIcon]
+ ? sHIL_JUMBO
+ : (width > fileIconSizes[LargeFileIcon] ? sHIL_EXTRALARGE : 0);
#else
0;
#endif // !USE_IIMAGELIST