forked from qt-creator/qt-creator
QmlDesigner: Change updateTransform to directUpdates
directUpdates is much clearer description of what is the intent of this new mechanism. Change-Id: I196b00b924027f92b62490377b270a85f9da1d1d Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
This commit is contained in:
@@ -123,7 +123,7 @@ void MoveManipulator::setDirectUpdateInNodeInstances(bool directUpdate)
|
||||
{
|
||||
foreach (FormEditorItem* item, m_itemList) {
|
||||
if (item && item->qmlItemNode().isValid())
|
||||
item->qmlItemNode().nodeInstance().setUpdateTransform(!directUpdate);
|
||||
item->qmlItemNode().nodeInstance().setDirectUpdate(directUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -86,8 +86,8 @@ public:
|
||||
qint32 parentId() const;
|
||||
qint32 instanceId() const;
|
||||
|
||||
void setUpdateTransform(bool updateTransform);
|
||||
bool updateTransform() const;
|
||||
void setDirectUpdate(bool directUpdates);
|
||||
bool directUpdates() const;
|
||||
void setX(double x);
|
||||
void setY(double y);
|
||||
|
||||
|
@@ -52,7 +52,7 @@ public:
|
||||
isMovable(false),
|
||||
isResizable(false),
|
||||
isInLayoutable(false),
|
||||
updateTransform(true)
|
||||
directUpdates(false)
|
||||
{}
|
||||
|
||||
qint32 parentInstanceId;
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
bool isMovable;
|
||||
bool isResizable;
|
||||
bool isInLayoutable;
|
||||
bool updateTransform;
|
||||
bool directUpdates;
|
||||
|
||||
|
||||
QHash<PropertyName, QVariant> propertyValues;
|
||||
@@ -135,23 +135,23 @@ qint32 NodeInstance::instanceId() const
|
||||
return -1;
|
||||
}
|
||||
|
||||
void NodeInstance::setUpdateTransform(bool updateTransform)
|
||||
void NodeInstance::setDirectUpdate(bool directUpdates)
|
||||
{
|
||||
if (d)
|
||||
d->updateTransform = updateTransform;
|
||||
d->directUpdates = directUpdates;
|
||||
}
|
||||
|
||||
bool NodeInstance::updateTransform() const
|
||||
bool NodeInstance::directUpdates() const
|
||||
{
|
||||
if (d)
|
||||
return d->updateTransform || d->transform.isRotating() || d->transform.isScaling();
|
||||
return d->directUpdates && !(d->transform.isRotating() || d->transform.isScaling());
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
void NodeInstance::setX(double x)
|
||||
{
|
||||
if(d && !updateTransform()) {
|
||||
if (d && directUpdates()) {
|
||||
double dx = x - d->transform.dx();
|
||||
d->transform.translate(dx, 0.0);
|
||||
}
|
||||
@@ -159,7 +159,7 @@ void NodeInstance::setX(double x)
|
||||
|
||||
void NodeInstance::setY(double y)
|
||||
{
|
||||
if(d && !updateTransform()) {
|
||||
if (d && directUpdates()) {
|
||||
double dy = y - d->transform.dy();
|
||||
d->transform.translate(0.0, dy);
|
||||
}
|
||||
@@ -407,7 +407,7 @@ InformationName NodeInstance::setInformationContentItemBoundingRect(const QRectF
|
||||
|
||||
InformationName NodeInstance::setInformationTransform(const QTransform &transform)
|
||||
{
|
||||
if (updateTransform() && d->transform != transform) {
|
||||
if (!directUpdates() && d->transform != transform) {
|
||||
d->transform = transform;
|
||||
return Transform;
|
||||
}
|
||||
|
@@ -688,7 +688,7 @@ void NodeInstanceView::updateChildren(const NodeAbstractProperty &newPropertyPar
|
||||
qint32 instanceId = childNode.internalId();
|
||||
if (hasInstanceForId(instanceId)) {
|
||||
NodeInstance instance = instanceForId(instanceId);
|
||||
if (!instance.updateTransform())
|
||||
if (instance.directUpdates())
|
||||
instance.setParentId(parentInstanceId);
|
||||
}
|
||||
}
|
||||
@@ -1245,7 +1245,7 @@ void NodeInstanceView::childrenChanged(const ChildrenChangedCommand &command)
|
||||
foreach (qint32 instanceId, command.childrenInstances()) {
|
||||
if (hasInstanceForId(instanceId)) {
|
||||
NodeInstance instance = instanceForId(instanceId);
|
||||
if (instance.updateTransform()) {
|
||||
if (!instance.directUpdates()) {
|
||||
instance.setParentId(command.parentInstanceId());
|
||||
childNodeVector.append(instance.modelNode());
|
||||
}
|
||||
|
Reference in New Issue
Block a user