From 7e5604cc566b6241a4ace03c006940a077123d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Wed, 22 Jan 2014 23:59:23 +0100 Subject: [PATCH] icon sizes move into Units They go into the propertymap, so are accessible now with units.iconSizes.huge, units.iconSizes.large, etc. --- .../plasmacomponents/units.cpp | 12 +++++++----- src/declarativeimports/plasmacomponents/units.h | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/declarativeimports/plasmacomponents/units.cpp b/src/declarativeimports/plasmacomponents/units.cpp index 2e9f3fc22..a8953fcbc 100644 --- a/src/declarativeimports/plasmacomponents/units.cpp +++ b/src/declarativeimports/plasmacomponents/units.cpp @@ -40,11 +40,7 @@ Units::Units (QObject *parent) m_dpiScale = (qreal)m_dpi / (qreal)96; m_iconSizes = new QQmlPropertyMap(this); - m_iconSizes->insert("desktop", QVariant(KIconLoader::global()->currentSize(KIconLoader::Desktop))); - m_iconSizes->insert("panel", QVariant(KIconLoader::global()->currentSize(KIconLoader::Panel))); - m_iconSizes->insert("toolbar", KIconLoader::global()->currentSize(KIconLoader::Toolbar)); - m_iconSizes->insert("small", KIconLoader::global()->currentSize(KIconLoader::Small)); - m_iconSizes->insert("dialog", KIconLoader::global()->currentSize(KIconLoader::Dialog)); + iconLoaderSettingsChanged(); connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()), this, SLOT(iconLoaderSettingsChanged())); @@ -64,6 +60,12 @@ void Units::iconLoaderSettingsChanged() m_iconSizes->insert("small", KIconLoader::global()->currentSize(KIconLoader::Small)); m_iconSizes->insert("dialog", KIconLoader::global()->currentSize(KIconLoader::Dialog)); + m_iconSizes->insert("smallMedium", KIconLoader::SizeSmallMedium); + m_iconSizes->insert("medium", KIconLoader::SizeMedium); + m_iconSizes->insert("large", KIconLoader::SizeLarge); + m_iconSizes->insert("huge", KIconLoader::SizeHuge); + m_iconSizes->insert("enormous", KIconLoader::SizeEnormous); + emit iconSizesChanged(); } diff --git a/src/declarativeimports/plasmacomponents/units.h b/src/declarativeimports/plasmacomponents/units.h index a1f7fecd0..55a638a04 100644 --- a/src/declarativeimports/plasmacomponents/units.h +++ b/src/declarativeimports/plasmacomponents/units.h @@ -38,12 +38,24 @@ class Units : public QObject Q_PROPERTY(qreal gridUnit READ gridUnit NOTIFY gridUnitChanged()) /** - * icon sizes depending from the context: use those if possible + * units.iconSizes provides access to platform-dependent icon sizing + * + * The icon sizes provided are normalized for different DPI, so icons + * will scale depending on the DPI. + * + * Icon sizes from KIconLoader: + * * small + * * smallMedium + * * medium + * * large + * * huge + * * enormous + * + * Icon sizes depending on the context: use those if possible * Access with units.iconSizes.desktop units.iconSizes.small etc. * available keys are: * * desktop * * toolbar - * * small * * dialog */ Q_PROPERTY(QQmlPropertyMap *iconSizes READ iconSizes NOTIFY iconSizesChanged)