Don't remove nodes from a parent whilst we're cycling through them
This commit is contained in:
parent
6c0dadc1c2
commit
be05a8394a
@ -51,6 +51,7 @@ public:
|
||||
, m_fitMode(fitMode)
|
||||
{
|
||||
m_lastParent->appendChildNode(this);
|
||||
|
||||
if (m_fitMode == Tile) {
|
||||
QString elementId = m_frameSvg->actualPrefix() + FrameSvgPrivate::borderToElementId(m_border);
|
||||
m_elementNativeSize = m_frameSvg->frameSvg()->elementSize(elementId);
|
||||
@ -70,19 +71,13 @@ public:
|
||||
void updateTexture(const QSize &size, const QString &elementId)
|
||||
{
|
||||
QImage image = m_frameSvg->frameSvg()->image(size, elementId);
|
||||
setVisible(!image.isNull());
|
||||
if(!image.isNull()) {
|
||||
QSGTexture *texture = m_frameSvg->window()->createTextureFromImage(image);
|
||||
setTexture(texture);
|
||||
}
|
||||
QSGTexture *texture = m_frameSvg->window()->createTextureFromImage(image);
|
||||
setTexture(texture);
|
||||
}
|
||||
|
||||
void reposition(const QRect& frameGeometry)
|
||||
{
|
||||
FrameData* frameData = m_frameSvg->frameData();
|
||||
if (!frameData) {
|
||||
return;
|
||||
}
|
||||
|
||||
QRect nodeRect = FrameSvgPrivate::sectionRect(frameData, m_border, frameGeometry);
|
||||
QRectF textureRect = QRectF(0,0,1,1);
|
||||
@ -98,28 +93,11 @@ public:
|
||||
QString elementId = m_frameSvg->actualPrefix() + FrameSvgPrivate::borderToElementId(m_border);
|
||||
updateTexture(nodeRect.size(), elementId);
|
||||
}
|
||||
Q_ASSERT(texture() || !isVisible());
|
||||
|
||||
QSGGeometry::updateTexturedRectGeometry(geometry(), nodeRect, textureRect);
|
||||
markDirty(QSGNode::DirtyGeometry);
|
||||
}
|
||||
|
||||
bool isVisible() const {
|
||||
return bool(parent());
|
||||
}
|
||||
|
||||
void setVisible(bool visible)
|
||||
{
|
||||
if (visible == bool(parent()))
|
||||
return;
|
||||
|
||||
if (visible) {
|
||||
m_lastParent->appendChildNode(this);
|
||||
} else {
|
||||
m_lastParent->removeChildNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
FrameSvgItem* m_frameSvg;
|
||||
FrameSvg::EnabledBorders m_border;
|
||||
|
Loading…
Reference in New Issue
Block a user