Commit 6f5c2ea5 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

QmlDesigner: Pass const values by references



Change-Id: I468b2bebec64680289b24044b0b4e3d5d734f604
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent 3d23a2da
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment