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:
parent
990662800d
commit
fb3e8d5fc5
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user