Sun, 25 Jul 2021 13:49:37 +0300
work on editing tools
96 | 1 | #include "selecttool.h" |
2 | ||
3 | SelectTool::SelectTool(QObject* parent) : | |
4 | BaseTool{parent} {} | |
5 | ||
6 | QString SelectTool::name() const | |
7 | { | |
8 | static const QString result = tr("Select"); | |
9 | return result; | |
10 | } | |
11 | ||
12 | QString SelectTool::toolTip() const | |
13 | { | |
14 | static const QString result = tr("Select elements from the model."); | |
15 | return result; | |
16 | } | |
107
02f142b399b1
Move selection logic into select tool
Teemu Piippo <teemu@hecknology.net>
parents:
96
diff
changeset
|
17 | |
02f142b399b1
Move selection logic into select tool
Teemu Piippo <teemu@hecknology.net>
parents:
96
diff
changeset
|
18 | bool SelectTool::mouseClick(const Canvas::MouseClickInfo& info) |
02f142b399b1
Move selection logic into select tool
Teemu Piippo <teemu@hecknology.net>
parents:
96
diff
changeset
|
19 | { |
02f142b399b1
Move selection logic into select tool
Teemu Piippo <teemu@hecknology.net>
parents:
96
diff
changeset
|
20 | const ldraw::id_t highlighted = info.invoker->getHighlightedObject(); |
02f142b399b1
Move selection logic into select tool
Teemu Piippo <teemu@hecknology.net>
parents:
96
diff
changeset
|
21 | info.invoker->clearSelection(); |
02f142b399b1
Move selection logic into select tool
Teemu Piippo <teemu@hecknology.net>
parents:
96
diff
changeset
|
22 | if (highlighted != ldraw::NULL_ID) |
02f142b399b1
Move selection logic into select tool
Teemu Piippo <teemu@hecknology.net>
parents:
96
diff
changeset
|
23 | { |
02f142b399b1
Move selection logic into select tool
Teemu Piippo <teemu@hecknology.net>
parents:
96
diff
changeset
|
24 | info.invoker->addToSelection(highlighted); |
02f142b399b1
Move selection logic into select tool
Teemu Piippo <teemu@hecknology.net>
parents:
96
diff
changeset
|
25 | } |
02f142b399b1
Move selection logic into select tool
Teemu Piippo <teemu@hecknology.net>
parents:
96
diff
changeset
|
26 | return true; |
02f142b399b1
Move selection logic into select tool
Teemu Piippo <teemu@hecknology.net>
parents:
96
diff
changeset
|
27 | } |