icon sizes move into Units

They go into the propertymap, so are accessible now with

units.iconSizes.huge, units.iconSizes.large, etc.
This commit is contained in:
Sebastian Kügler 2014-01-22 23:59:23 +01:00
parent 34e66fa80e
commit 7e5604cc56
2 changed files with 21 additions and 7 deletions

View File

@ -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();
}

View File

@ -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)