Avoid frame resizing till componentCompleted

This commit is contained in:
David Edmundson 2014-02-13 12:45:21 +01:00
parent 5c6077c728
commit 6bff4ef469
2 changed files with 22 additions and 5 deletions

View File

@ -94,8 +94,10 @@ void FrameSvgItem::setImagePath(const QString &path)
emit imagePathChanged();
m_margins->update();
if (isComponentComplete()) {
m_frameSvg->resizeFrame(QSizeF(width(), height()));
update();
}
}
QString FrameSvgItem::imagePath() const
@ -123,8 +125,11 @@ void FrameSvgItem::setPrefix(const QString &prefix)
emit prefixChanged();
m_margins->update();
if (isComponentComplete()) {
m_frameSvg->resizeFrame(QSizeF(width(), height()));
update();
}
}
QString FrameSvgItem::prefix() const
@ -160,7 +165,9 @@ void FrameSvgItem::paint(QPainter *painter)
void FrameSvgItem::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
if (isComponentComplete()) {
m_frameSvg->resizeFrame(newGeometry.size());
}
QQuickItem::geometryChanged(newGeometry, oldGeometry);
}
@ -214,6 +221,13 @@ Plasma::FrameSvg *FrameSvgItem::frameSvg() const
return m_frameSvg;
}
void FrameSvgItem::componentComplete()
{
QQuickItem::componentComplete();
m_frameSvg->resizeFrame(QSize(width(), height()));
}
} // Plasma namespace
#include "framesvgitem.moc"

View File

@ -143,6 +143,9 @@ public:
*/
Plasma::FrameSvg *frameSvg() const;
protected:
virtual void componentComplete();
Q_SIGNALS:
void imagePathChanged();
void prefixChanged();