resize the graphics object as soon as possible

it avoids many resizes that take cpu cycles and mess with the layout
This commit is contained in:
Marco Martin 2013-09-20 23:28:38 +02:00
parent 4767f3a8d0
commit e16c30142f
3 changed files with 8 additions and 3 deletions

View File

@ -102,7 +102,9 @@ void PlasmaQuickViewPrivate::setContainment(Plasma::Containment *cont)
if (graphicObject) {
qDebug() << "using as graphic containment" << graphicObject << containment.data();
//graphicObject->setProperty("visible", false);
//by resizing before adding, it will avoid some resizes in most cases
graphicObject->setProperty("width", q->width());
graphicObject->setProperty("height", q->height());
graphicObject->setProperty("drawWallpaper",
(cont->containmentType() == Plasma::Types::DesktopContainment ||
cont->containmentType() == Plasma::Types::CustomContainment));

View File

@ -143,7 +143,11 @@ void AppletInterface::init()
m_qmlObject->engine()->rootContext()->setContextProperty("plasmoid", this);
m_qmlObject->completeInitialization();
//initialize size, so an useless resize less
QVariantHash initialProperties;
initialProperties["width"] = width();
initialProperties["height"] = height();
m_qmlObject->completeInitialization(initialProperties);
qDebug() << "Graphic object created:" << applet() << applet()->property("graphicObject");

View File

@ -55,7 +55,6 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent)
m_wallpaperInterface(0)
{
setAcceptedMouseButtons(Qt::AllButtons);
setFlag(QQuickItem::ItemAcceptsDrops);
qmlRegisterType<ContainmentInterface>();