forked from qt-creator/qt-creator
QmlDesigner: Add Loader and Repeater to component library
Also fixes some issues with Repeater usage. Fixes: QDS-5149 Change-Id: I259dcb73be634150dd0c5e602165b63112ec958c Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include <addimportcontainer.h>
|
||||
#include <createscenecommand.h>
|
||||
#include <reparentinstancescommand.h>
|
||||
#include <removeinstancescommand.h>
|
||||
#include <clearscenecommand.h>
|
||||
|
||||
#include <QDebug>
|
||||
@@ -193,6 +194,19 @@ QList<QQuickItem*> Qt5NodeInstanceServer::allItems() const
|
||||
return QList<QQuickItem*>();
|
||||
}
|
||||
|
||||
void Qt5NodeInstanceServer::markRepeaterParentDirty(qint32 id) const
|
||||
{
|
||||
if (!hasInstanceForId(id))
|
||||
return;
|
||||
|
||||
// If a Repeater instance was moved/removed, the old parent must be marked dirty to rerender it
|
||||
ServerNodeInstance instance = instanceForId(id);
|
||||
if (instance.isValid() && instance.isSubclassOf("QQuickRepeater") && instance.hasParent()) {
|
||||
ServerNodeInstance parentInstance = instance.parent();
|
||||
DesignerSupport::addDirty(parentInstance.rootQuickItem(), QQuickDesignerSupport::Content);
|
||||
}
|
||||
}
|
||||
|
||||
bool Qt5NodeInstanceServer::initRhi(RenderViewData &viewData)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
@@ -523,9 +537,23 @@ void Qt5NodeInstanceServer::clearScene(const ClearSceneCommand &command)
|
||||
|
||||
void Qt5NodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command)
|
||||
{
|
||||
const QVector<ReparentContainer> &containerVector = command.reparentInstances();
|
||||
for (const ReparentContainer &container : containerVector)
|
||||
markRepeaterParentDirty(container.instanceId());
|
||||
|
||||
NodeInstanceServer::reparentInstances(command.reparentInstances());
|
||||
startRenderTimer();
|
||||
}
|
||||
|
||||
void Qt5NodeInstanceServer::removeInstances(const RemoveInstancesCommand &command)
|
||||
{
|
||||
const QVector<qint32> &idVector = command.instanceIds();
|
||||
for (const qint32 id : idVector)
|
||||
markRepeaterParentDirty(id);
|
||||
|
||||
NodeInstanceServer::removeInstances(command);
|
||||
startRenderTimer();
|
||||
}
|
||||
|
||||
|
||||
} // QmlDesigner
|
||||
|
||||
Reference in New Issue
Block a user