13 { |
13 { |
14 static const QString result = tr("Select elements from the model."); |
14 static const QString result = tr("Select elements from the model."); |
15 return result; |
15 return result; |
16 } |
16 } |
17 |
17 |
18 bool SelectTool::mouseClick(Document* document, Canvas* canvas) |
18 bool SelectTool::mouseClick(Document* document, Canvas* canvas, QMouseEvent* event) |
19 { |
19 { |
20 static_cast<void>(document); |
20 if (event->button() == Qt::LeftButton) |
21 const ldraw::id_t highlighted = canvas->getHighlightedObject(); |
|
22 canvas->clearSelection(); |
|
23 if (highlighted != ldraw::NULL_ID) |
|
24 { |
21 { |
25 canvas->addToSelection(highlighted); |
22 static_cast<void>(document); |
|
23 const ldraw::id_t highlighted = canvas->getHighlightedObject(); |
|
24 canvas->clearSelection(); |
|
25 if (highlighted != ldraw::NULL_ID) |
|
26 { |
|
27 canvas->addToSelection(highlighted); |
|
28 } |
|
29 return true; |
26 } |
30 } |
27 return true; |
31 else |
|
32 { |
|
33 return false; |
|
34 } |
28 } |
35 } |