forked from qt-creator/qt-creator
QmlDesigner: Pass const values by references
Change-Id: I468b2bebec64680289b24044b0b4e3d5d734f604 Reviewed-by: Tim Jenssen <tim.jenssen@digia.com> Reviewed-by: Marco Bubke <marco.bubke@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
3d23a2dad2
commit
6f5c2ea5b0
@@ -362,7 +362,7 @@ static inline void backupPropertyAndRemove(ModelNode node, const PropertyName &p
|
||||
}
|
||||
|
||||
|
||||
static inline void restoreProperty(ModelNode node, const PropertyName &propertyName)
|
||||
static inline void restoreProperty(const ModelNode &node, const PropertyName &propertyName)
|
||||
{
|
||||
if (node.hasAuxiliaryData(auxDataString + propertyName))
|
||||
node.variantProperty(propertyName).setValue(node.auxiliaryData(auxDataString + propertyName));
|
||||
|
||||
@@ -209,7 +209,8 @@ static void updateAnchorLinePoints(QPointF *firstPoint, QPointF *secondPoint, co
|
||||
*secondPoint = anchorLine.qmlItemNode().instanceSceneTransform().map(*secondPoint);
|
||||
}
|
||||
|
||||
void AnchorIndicatorGraphicsItem::updateAnchorIndicator(const AnchorLine &sourceAnchorLine, const AnchorLine targetAnchorLine)
|
||||
void AnchorIndicatorGraphicsItem::updateAnchorIndicator(const AnchorLine &sourceAnchorLine,
|
||||
const AnchorLine &targetAnchorLine)
|
||||
{
|
||||
if (sourceAnchorLine.qmlItemNode().isValid() && targetAnchorLine.qmlItemNode().isValid()) {
|
||||
m_sourceAnchorLineType = sourceAnchorLine.type();
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QRectF boundingRect() const;
|
||||
|
||||
void updateAnchorIndicator(const AnchorLine &sourceAnchorLine, const AnchorLine targetAnchorLine);
|
||||
void updateAnchorIndicator(const AnchorLine &sourceAnchorLine, const AnchorLine &targetAnchorLine);
|
||||
|
||||
AnchorLineType sourceAnchorLineType() const;
|
||||
void setSourceAnchorLineType(const AnchorLineType &sourceAnchorLineType);
|
||||
|
||||
@@ -145,7 +145,9 @@ void DragTool::beginWithPoint(const QPointF &beginPoint)
|
||||
m_moveManipulator.begin(beginPoint);
|
||||
}
|
||||
|
||||
void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlItemNode parentNode, QPointF scenePos)
|
||||
void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry,
|
||||
const QmlItemNode &parentNode,
|
||||
const QPointF &scenePos)
|
||||
{
|
||||
MetaInfo metaInfo = MetaInfo::global();
|
||||
|
||||
@@ -161,7 +163,9 @@ void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlIt
|
||||
m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList));
|
||||
}
|
||||
|
||||
void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode parentNode, QPointF scenePos)
|
||||
void DragTool::createQmlItemNodeFromImage(const QString &imageName,
|
||||
const QmlItemNode &parentNode,
|
||||
const QPointF &scenePos)
|
||||
{
|
||||
if (!parentNode.isValid())
|
||||
return;
|
||||
@@ -392,7 +396,7 @@ void DragTool::end(Snapper::Snapping useSnapping)
|
||||
clear();
|
||||
}
|
||||
|
||||
void DragTool::move(QPointF scenePos)
|
||||
void DragTool::move(const QPointF &scenePos)
|
||||
{
|
||||
if (!m_movingItem)
|
||||
return;
|
||||
|
||||
@@ -110,14 +110,14 @@ protected:
|
||||
|
||||
private:
|
||||
void commitTransaction();
|
||||
void createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlItemNode parentNode, QPointF scenePos);
|
||||
void createQmlItemNodeFromImage(const QString &imageName, QmlItemNode parentNode, QPointF scenePos);
|
||||
void createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, const QmlItemNode &parentNode, const QPointF &scenePos);
|
||||
void createQmlItemNodeFromImage(const QString &imageName, const QmlItemNode &parentNode, const QPointF &scenePos);
|
||||
FormEditorItem* calculateContainer(const QPointF &point, FormEditorItem * currentItem = 0);
|
||||
|
||||
void begin(QPointF scenePos);
|
||||
void end();
|
||||
void end(Snapper::Snapping useSnapping);
|
||||
void move(QPointF scenePos);
|
||||
void move(const QPointF &scenePos);
|
||||
|
||||
MoveManipulator m_moveManipulator;
|
||||
SelectionIndicator m_selectionIndicator;
|
||||
|
||||
@@ -422,7 +422,7 @@ void DesignDocument::cutSelected()
|
||||
deleteSelected();
|
||||
}
|
||||
|
||||
static void scatterItem(ModelNode pastedNode, const ModelNode targetNode, int offset = -2000)
|
||||
static void scatterItem(const ModelNode &pastedNode, const ModelNode &targetNode, int offset = -2000)
|
||||
{
|
||||
|
||||
bool scatter = false;
|
||||
|
||||
@@ -44,7 +44,7 @@ FileResourcesModel::FileResourcesModel(QObject *parent) :
|
||||
{
|
||||
}
|
||||
|
||||
void FileResourcesModel::setAnchorBackend(const QVariant anchorBackend)
|
||||
void FileResourcesModel::setAnchorBackend(const QVariant &anchorBackend)
|
||||
{
|
||||
|
||||
QObject* anchorBackendObject = anchorBackend.value<QObject*>();
|
||||
|
||||
@@ -50,7 +50,7 @@ class FileResourcesModel : public QObject
|
||||
public:
|
||||
explicit FileResourcesModel(QObject *parent = 0);
|
||||
|
||||
void setAnchorBackend(const QVariant anchorBackend);
|
||||
void setAnchorBackend(const QVariant &anchorBackend);
|
||||
QString fileName() const;
|
||||
void setFileName(const QUrl &fileName);
|
||||
void setFileNameStr(const QString &fileName);
|
||||
|
||||
@@ -287,7 +287,7 @@ void GradientModel::setupModel()
|
||||
m_lock = false;
|
||||
}
|
||||
|
||||
void GradientModel::setAnchorBackend(const QVariant anchorBackend)
|
||||
void GradientModel::setAnchorBackend(const QVariant &anchorBackend)
|
||||
{
|
||||
QObject* anchorBackendObject = anchorBackend.value<QObject*>();
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public slots:
|
||||
|
||||
private:
|
||||
void setupModel();
|
||||
void setAnchorBackend(const QVariant anchorBackend);
|
||||
void setAnchorBackend(const QVariant &anchorBackend);
|
||||
QVariant anchorBackend() const {return QVariant(); }
|
||||
QString gradientPropertyName() const;
|
||||
void setGradientPropertyName(const QString &name);
|
||||
|
||||
@@ -57,7 +57,7 @@ QVariant PropertyEditorValue::value() const
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
static bool cleverDoubleCompare(QVariant value1, QVariant value2)
|
||||
static bool cleverDoubleCompare(const QVariant &value1, const QVariant &value2)
|
||||
{ //we ignore slight changes on doubles
|
||||
if ((value1.type() == QVariant::Double) && (value2.type() == QVariant::Double)) {
|
||||
int a = value1.toDouble() * 100;
|
||||
@@ -69,7 +69,7 @@ static bool cleverDoubleCompare(QVariant value1, QVariant value2)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool cleverColorCompare(QVariant value1, QVariant value2)
|
||||
static bool cleverColorCompare(const QVariant &value1, const QVariant &value2)
|
||||
{
|
||||
if ((value1.type() == QVariant::Color) && (value2.type() == QVariant::Color)) {
|
||||
QColor c1 = value1.value<QColor>();
|
||||
|
||||
@@ -57,7 +57,7 @@ static inline void backupPropertyAndRemove(ModelNode node, const PropertyName &p
|
||||
}
|
||||
|
||||
|
||||
static inline void restoreProperty(ModelNode node, const PropertyName &propertyName)
|
||||
static inline void restoreProperty(const ModelNode &node, const PropertyName &propertyName)
|
||||
{
|
||||
if (node.hasAuxiliaryData(auxDataString + propertyName))
|
||||
node.variantProperty(propertyName).setValue(node.auxiliaryData(auxDataString + propertyName));
|
||||
@@ -682,7 +682,7 @@ void QmlAnchorBindingProxy::setRightAnchor(bool anchor)
|
||||
return QRect();
|
||||
}
|
||||
|
||||
QRectF QmlAnchorBindingProxy::boundingBox(QmlItemNode node)
|
||||
QRectF QmlAnchorBindingProxy::boundingBox(const QmlItemNode &node)
|
||||
{
|
||||
if (node.isValid())
|
||||
return node.instanceTransformWithContentTransform().mapRect(node.instanceBoundingRect());
|
||||
|
||||
@@ -215,7 +215,7 @@ private:
|
||||
|
||||
QRectF parentBoundingBox();
|
||||
|
||||
QRectF boundingBox(QmlItemNode node);
|
||||
QRectF boundingBox(const QmlItemNode &node);
|
||||
|
||||
QRectF transformedBoundingBox();
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ bool MoveObjectVisitor::visit(UiObjectDefinition *ast)
|
||||
return !didRewriting();
|
||||
}
|
||||
|
||||
void MoveObjectVisitor::doMove(TextModifier::MoveInfo moveInfo)
|
||||
void MoveObjectVisitor::doMove(const TextModifier::MoveInfo &moveInfo)
|
||||
{
|
||||
if (moveInfo.objectEnd > moveInfo.objectStart) {
|
||||
Inserter findTargetAndInsert(*textModifier(),
|
||||
|
||||
@@ -53,7 +53,7 @@ protected:
|
||||
virtual bool visit(QmlJS::AST::UiObjectDefinition *ast);
|
||||
|
||||
private:
|
||||
void doMove(QmlDesigner::TextModifier::MoveInfo moveInfo);
|
||||
void doMove(const TextModifier::MoveInfo &moveInfo);
|
||||
|
||||
private:
|
||||
QList<QmlJS::AST::Node *> parents;
|
||||
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
|
||||
ModelNode modelNodeForId(const QString &id);
|
||||
bool hasId(const QString &id) const;
|
||||
QString generateNewId(const QString prefixName) const;
|
||||
QString generateNewId(const QString &prefixName) const;
|
||||
|
||||
ModelNode modelNodeForInternalId(qint32 internalId) const;
|
||||
bool hasModelNodeForInternalId(qint32 internalId) const;
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
|
||||
ModelNode();
|
||||
ModelNode(const Internal::InternalNodePointer &internalNode, Model *model, const AbstractView *view);
|
||||
ModelNode(const ModelNode modelNode, AbstractView *view);
|
||||
ModelNode(const ModelNode &modelNode, AbstractView *view);
|
||||
ModelNode(const ModelNode &other);
|
||||
~ModelNode();
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
|
||||
void removeProperty(const PropertyName &name);
|
||||
|
||||
void setParent(QmlObjectNode newParent);
|
||||
void setParent(const QmlObjectNode &newParent);
|
||||
|
||||
QmlItemNode toQmlItemNode() const;
|
||||
|
||||
|
||||
@@ -352,7 +352,7 @@ bool AbstractView::hasId(const QString &id) const
|
||||
return model()->d->hasId(id);
|
||||
}
|
||||
|
||||
QString firstCharToLower(const QString string)
|
||||
QString firstCharToLower(const QString &string)
|
||||
{
|
||||
QString resultString = string;
|
||||
|
||||
@@ -362,7 +362,7 @@ QString firstCharToLower(const QString string)
|
||||
return resultString;
|
||||
}
|
||||
|
||||
QString AbstractView::generateNewId(const QString prefixName) const
|
||||
QString AbstractView::generateNewId(const QString &prefixName) const
|
||||
{
|
||||
int counter = 1;
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ ModelNode::ModelNode(const InternalNodePointer &internalNode, Model *model, cons
|
||||
Q_ASSERT(!m_model || m_view);
|
||||
}
|
||||
|
||||
ModelNode::ModelNode(const ModelNode modelNode, AbstractView *view)
|
||||
ModelNode::ModelNode(const ModelNode &modelNode, AbstractView *view)
|
||||
: m_internalNode(modelNode.m_internalNode),
|
||||
m_model(modelNode.model()),
|
||||
m_view(view)
|
||||
|
||||
@@ -523,7 +523,7 @@ PropertyName QmlObjectNode::defaultPropertyName() const
|
||||
return modelNode().metaInfo().defaultPropertyName();
|
||||
}
|
||||
|
||||
void QmlObjectNode::setParent(QmlObjectNode newParent)
|
||||
void QmlObjectNode::setParent(const QmlObjectNode &newParent)
|
||||
{
|
||||
if (newParent.hasDefaultPropertyName())
|
||||
newParent.modelNode().defaultNodeAbstractProperty().reparentHere(modelNode());
|
||||
|
||||
@@ -43,7 +43,7 @@ static inline DesignDocument* currentDesignDocument()
|
||||
return QmlDesignerPlugin::instance()->documentManager().currentDesignDocument();
|
||||
}
|
||||
|
||||
static inline void getProperties(const ModelNode node, QHash<PropertyName, QVariant> &propertyHash)
|
||||
static inline void getProperties(const ModelNode &node, QHash<PropertyName, QVariant> &propertyHash)
|
||||
{
|
||||
if (QmlObjectNode::isValidQmlObjectNode(node)) {
|
||||
foreach (const AbstractProperty &abstractProperty, node.properties()) {
|
||||
|
||||
Reference in New Issue
Block a user