QmlJSDebugger: Simplify selection handling code

Avoids multiple calls singleSelectionManipulator.select().
This commit is contained in:
Kai Koehne
2010-10-22 16:12:59 +02:00
parent 3bec12a4bf
commit d16c75fe00

View File

@@ -107,51 +107,9 @@ void SelectionTool::mousePressEvent(QMouseEvent *event)
if (m_rubberbandSelectionMode) {
m_rubberbandSelectionManipulator.begin(event->pos());
} else {
if (itemList.isEmpty()) {
QDeclarativeViewObserverPrivate::get(observer())->setSelectedItems(itemList);
return;
}
if ((selectionType == SingleSelectionManipulator::InvertSelection
|| selectionType == SingleSelectionManipulator::ReplaceSelection)
&& alreadySelected(itemList))
{
//view()->changeToMoveTool(event->pos());
return;
}
QGraphicsItem* item = itemList.first();
if (item->children().isEmpty()) {
m_singleSelectionManipulator.begin(event->pos());
m_singleSelectionManipulator.select(selectionType, m_selectOnlyContentItems);
} else {
m_mousePressTimer.start();
if (itemList.isEmpty()) {
observer()->setSelectedItems(itemList);
return;
}
if (item->children().isEmpty()) {
m_singleSelectionManipulator.begin(event->pos());
m_singleSelectionManipulator.select(selectionType, m_selectOnlyContentItems);
} else {
m_singleSelectionManipulator.begin(event->pos());
m_singleSelectionManipulator.select(selectionType, m_selectOnlyContentItems);
m_singleSelectionManipulator.end(event->pos());
//view()->changeToMoveTool(event->pos());
}
m_singleSelectionManipulator.begin(event->pos());
m_singleSelectionManipulator.select(selectionType, m_selectOnlyContentItems);
m_singleSelectionManipulator.end(event->pos());
//view()->changeToMoveTool(event->pos());
}
m_singleSelectionManipulator.begin(event->pos());
m_singleSelectionManipulator.select(selectionType, m_selectOnlyContentItems);
}
} else if (event->buttons() & Qt::RightButton) {
createContextMenu(itemList, event->globalPos());
}