[Icon Item] Use ItemEnabledHasChanged

Preferred over having a connect and it go through meta signal invocation when it's emitted

Differential Revision: https://phabricator.kde.org/D14531
This commit is contained in:
Kai Uwe Broulik 2018-08-17 15:46:29 +02:00
parent 938cef210c
commit e143f7d457

View File

@ -67,8 +67,10 @@ IconItem::IconItem(QQuickItem *parent)
connect(KIconLoader::global(), &KIconLoader::iconLoaderSettingsChanged,
this, &IconItem::updateImplicitSize);
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
connect(this, &QQuickItem::enabledChanged,
this, &IconItem::onEnabledChanged);
#endif
connect(this, &IconItem::implicitWidthChanged, this, &IconItem::implicitWidthChanged2);
connect(this, &IconItem::implicitHeightChanged, this, &IconItem::implicitHeightChanged2);
@ -654,6 +656,10 @@ void IconItem::itemChange(ItemChange change, const ItemChangeData &value)
{
if (change == ItemVisibleHasChanged && value.boolValue) {
m_blockNextAnimation = true;
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
} else if (change == ItemEnabledHasChanged) {
onEnabledChanged();
#endif
} else if (change == ItemSceneChange && value.window) {
schedulePixmapUpdate();
}