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

View File

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