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
This commit is contained in:
David Edmundson 2016-06-29 11:36:20 +01:00
parent 990662800d
commit fb3e8d5fc5
3 changed files with 3 additions and 6 deletions

View File

@ -543,8 +543,7 @@ void AppletQuickItem::init()
if (d->qmlObject->rootObject() && (width() <= 0 || height() <= 0)) {
const qreal w = d->qmlObject->rootObject()->property("width").value<qreal>();
const qreal h = d->qmlObject->rootObject()->property("height").value<qreal>();
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

View File

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

View File

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