QSideBar: take the icon size from a style

Change-Id: I9c4677b42cc920b7bb016b61b8c1fd34fe67aa30
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Alexander Volkov 2018-09-18 16:41:44 +03:00
parent 41418a92b7
commit d66253665a
2 changed files with 11 additions and 3 deletions

View File

@ -381,8 +381,6 @@ QSidebar::QSidebar(QWidget *parent) : QListView(parent)
void QSidebar::setModelAndUrls(QFileSystemModel *model, const QList<QUrl> &newUrls)
{
// ### TODO make icon size dynamic
setIconSize(QSize(24,24));
setUniformItemSizes(true);
urlModel = new QUrlModel(this);
urlModel->setFileSystemModel(model);

View File

@ -100,6 +100,9 @@
#if QT_CONFIG(wizard)
#include <qwizard.h>
#endif
#if QT_CONFIG(filedialog)
#include <qsidebar_p.h>
#endif
#include <qfileinfo.h>
#include <qdir.h>
#include <qsettings.h>
@ -4720,9 +4723,16 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_TabBarIconSize:
case PM_ListViewIconSize:
ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
break;
case PM_ListViewIconSize:
#if QT_CONFIG(filedialog)
if (qobject_cast<const QSidebar *>(widget))
ret = int(QStyleHelper::dpiScaled(24.));
else
#endif
ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
break;
case PM_ButtonIconSize:
case PM_SmallIconSize: