Use setSize() instead of setProperty width and height

We know we have a QQuickItem so we can just use its methods directly and then also use setSize
which does both at once, saving intermediate signal emission and potential re-layouting

Differential Revision: https://phabricator.kde.org/D9068
This commit is contained in:
Kai Uwe Broulik 2017-11-30 14:17:32 +01:00
parent 5d9aa6816f
commit b6b81c67b3
2 changed files with 2 additions and 4 deletions

View File

@ -137,8 +137,7 @@ void ContainmentViewPrivate::setContainment(Plasma::Containment *cont)
graphicObject->setFocus(true);
//by resizing before adding, it will avoid some resizes in most cases
graphicObject->setProperty("width", q->width());
graphicObject->setProperty("height", q->height());
graphicObject->setSize(q->size());
graphicObject->setParentItem(q->rootObject());
if (q->rootObject()) {
q->rootObject()->setProperty("containment", QVariant::fromValue(graphicObject));

View File

@ -119,8 +119,7 @@ void ViewPrivate::setContainment(Plasma::Containment *cont)
// qDebug() << "using as graphic containment" << graphicObject << containment.data();
//by resizing before adding, it will avoid some resizes in most cases
graphicObject->setProperty("width", q->width());
graphicObject->setProperty("height", q->height());
graphicObject->setSize(q->size());
graphicObject->setParentItem(q->rootObject());
if (q->rootObject()) {
q->rootObject()->setProperty("containment", QVariant::fromValue(graphicObject));