From fb3e8d5fc5841cd176e88827016cefb3eac30ef0 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 29 Jun 2016 11:36:20 +0100 Subject: [PATCH] Make use of QQuickItem::setSize Even though QQuickItem only has a width and height accessor there is a usable public setSize method. This gets rid of a lot of potential re-evaluation as internal geometry is updated before widthChanged is emitted. REVIEW: 128316 --- src/plasmaquick/appletquickitem.cpp | 3 +-- src/plasmaquick/configview.cpp | 3 +-- src/scriptengines/qml/plasmoid/wallpaperinterface.cpp | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plasmaquick/appletquickitem.cpp b/src/plasmaquick/appletquickitem.cpp index a9d044b1b..a95c445d0 100644 --- a/src/plasmaquick/appletquickitem.cpp +++ b/src/plasmaquick/appletquickitem.cpp @@ -543,8 +543,7 @@ void AppletQuickItem::init() if (d->qmlObject->rootObject() && (width() <= 0 || height() <= 0)) { const qreal w = d->qmlObject->rootObject()->property("width").value(); const qreal h = d->qmlObject->rootObject()->property("height").value(); - setWidth(parentItem() ? std::min(parentItem()->width(), w) : w); - setHeight(parentItem() ? std::min(parentItem()->height(), h) : h); + setSize(parentItem() ? QSizeF(std::min(parentItem()->width(), w), std::min(parentItem()->height(), h)) : QSizeF(w, h)); } //default fullrepresentation is our root main component, if none specified diff --git a/src/plasmaquick/configview.cpp b/src/plasmaquick/configview.cpp index 5c2920bdc..b6ef7acb1 100644 --- a/src/plasmaquick/configview.cpp +++ b/src/plasmaquick/configview.cpp @@ -333,8 +333,7 @@ void ConfigView::resizeEvent(QResizeEvent *re) if (!rootObject()) { return; } - rootObject()->setWidth(re->size().width()); - rootObject()->setHeight(re->size().height()); + rootObject()->setSize(re->size()); if (d->applet) { KConfigGroup cg = d->applet.data()->config(); diff --git a/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp b/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp index adacbe19c..507c82f03 100644 --- a/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp +++ b/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp @@ -50,8 +50,7 @@ WallpaperInterface::WallpaperInterface(ContainmentInterface *parent) //resize at the beginning to avoid as much resize events as possible if (parent) { - setWidth(parent->width()); - setHeight(parent->height()); + setSize(QSizeF(parent->width(), parent->height())); } if (!m_containmentInterface->containment()->wallpaper().isEmpty()) {