DeclarativeObserver: Fixed duplicates in item selection

Only add items to the current selection that aren't already part of it.

Also removed checking item for null, since it doesn't make sense to
include null pointers in the list of items to select.

Task-number: QTCREATORBUG-3426
Change-Id: I5a365570f87f72665b3382d05ca9937f56e8956b
Reviewed-on: http://codereview.qt.nokia.com/111
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
This commit is contained in:
Thorbjørn Lindeijer
2011-05-25 13:42:48 +02:00
committed by Christiaan Janssen
parent b9bbf24680
commit cf88d6a812
@@ -635,8 +635,8 @@ void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(QList<QGraphicsIt
}
foreach (QGraphicsItem *item, items) {
if (item) {
if (QGraphicsObject *obj = item->toGraphicsObject()) {
if (QGraphicsObject *obj = item->toGraphicsObject()) {
if (!currentSelection.contains(obj)) {
QObject::connect(obj, SIGNAL(destroyed(QObject*)),
this, SLOT(_q_removeFromSelection(QObject*)));
currentSelection.append(obj);