diff options
author | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2011-05-17 09:23:10 (GMT) |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2011-05-17 10:13:43 (GMT) |
commit | bdd8f188ac352c99ee218318a59089f387a31d60 (patch) | |
tree | 15498485f6026a038339a618437717c72e136948 /src/plugins/qmltooling | |
parent | d03065da2999b8539d8c5160b58d56dd94373d6f (diff) | |
download | Qt-bdd8f188ac352c99ee218318a59089f387a31d60.zip Qt-bdd8f188ac352c99ee218318a59089f387a31d60.tar.gz Qt-bdd8f188ac352c99ee218318a59089f387a31d60.tar.bz2 |
Pass QList as const reference when possible
Avoids some reference counting.
Reviewed-by: Kai Koehne
Change-Id: I4de83aa4df6833fa2287ac1854bbb0052d15cee9
Diffstat (limited to 'src/plugins/qmltooling')
3 files changed, 10 insertions, 8 deletions
diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp index 2286990..d9ff9db 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp +++ b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp @@ -557,7 +557,7 @@ void QDeclarativeViewObserverPrivate::changeTool(Constants::DesignTool tool, } } -void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(QList<QGraphicsItem *> items) +void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(const QList<QGraphicsItem *> &items) { foreach (const QWeakPointer<QGraphicsObject> &obj, currentSelection) { if (QGraphicsItem *item = obj.data()) { @@ -582,7 +582,7 @@ void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(QList<QGraphicsIt currentTool->updateSelectedItems(); } -void QDeclarativeViewObserverPrivate::setSelectedItems(QList<QGraphicsItem *> items) +void QDeclarativeViewObserverPrivate::setSelectedItems(const QList<QGraphicsItem *> &items) { QList<QWeakPointer<QGraphicsObject> > oldList = currentSelection; setSelectedItemsForTools(items); @@ -633,7 +633,8 @@ void QDeclarativeViewObserverPrivate::highlight(QGraphicsObject * item, ContextF highlight(QList<QGraphicsObject*>() << item, flags); } -void QDeclarativeViewObserverPrivate::highlight(QList<QGraphicsObject *> items, ContextFlags flags) +void QDeclarativeViewObserverPrivate::highlight(const QList<QGraphicsObject *> &items, + ContextFlags flags) { if (items.isEmpty()) return; @@ -1064,7 +1065,7 @@ void QDeclarativeViewObserver::sendDesignModeBehavior(bool inDesignMode) data->debugService->sendMessage(message); } -void QDeclarativeViewObserver::sendCurrentObjects(QList<QObject*> objects) +void QDeclarativeViewObserver::sendCurrentObjects(const QList<QObject*> &objects) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h index 6e986c2..0ad447c 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h +++ b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h @@ -78,7 +78,7 @@ public: bool showAppOnTop() const; void sendDesignModeBehavior(bool inDesignMode); - void sendCurrentObjects(QList<QObject*> items); + void sendCurrentObjects(const QList<QObject*> &); void sendAnimationSpeed(qreal slowDownFactor); void sendAnimationPaused(bool paused); void sendCurrentTool(Constants::DesignTool toolId); diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h index 6022555..eba71d4 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h +++ b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h @@ -117,15 +117,16 @@ public: QList<QGraphicsItem*> selectableItems(const QPointF &scenePos) const; QList<QGraphicsItem*> selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const; - void setSelectedItemsForTools(QList<QGraphicsItem *> items); - void setSelectedItems(QList<QGraphicsItem *> items); + void setSelectedItemsForTools(const QList<QGraphicsItem *> &items); + void setSelectedItems(const QList<QGraphicsItem *> &items); QList<QGraphicsItem *> selectedItems() const; void changeTool(Constants::DesignTool tool, Constants::ToolFlags flags = Constants::NoToolFlags); void clearHighlight(); - void highlight(QList<QGraphicsObject *> item, ContextFlags flags = ContextSensitive); + void highlight(const QList<QGraphicsObject *> &item, + ContextFlags flags = ContextSensitive); void highlight(QGraphicsObject *item, ContextFlags flags = ContextSensitive); bool mouseInsideContextItem() const; |