1 #include "selecttool.h" |
1 #include "selecttool.h" |
2 |
2 |
3 SelectTool::SelectTool(Model* model, QObject* parent) : |
3 SelectTool::SelectTool(Model* model, QWidget* parent) : |
4 BaseTool{model, parent}, |
4 BaseTool{model, parent}, |
5 objectEditor{model, ldraw::NULL_ID, nullptr} {} |
5 objectEditor{new ObjectEditor{model, ldraw::NULL_ID, parent}} {} |
6 |
6 |
7 QString SelectTool::name() const |
7 QString SelectTool::name() const |
8 { |
8 { |
9 static const QString result = tr("Select"); |
9 static const QString result = tr("Select"); |
10 return result; |
10 return result; |
35 } |
35 } |
36 } |
36 } |
37 |
37 |
38 QWidget* SelectTool::toolWidget() |
38 QWidget* SelectTool::toolWidget() |
39 { |
39 { |
40 return &this->objectEditor; |
40 return this->objectEditor; |
41 } |
41 } |
42 |
42 |
43 void SelectTool::selectionChanged(const QSet<ldraw::id_t>& newSelection) |
43 void SelectTool::selectionChanged(const QSet<ldraw::id_t>& newSelection) |
44 { |
44 { |
45 if (newSelection.size() == 1) |
45 if (newSelection.size() == 1) |
46 { |
46 { |
47 this->objectEditor.setObjectId(*newSelection.begin()); |
47 this->objectEditor->setObjectId(*newSelection.begin()); |
48 } |
48 } |
49 else |
49 else |
50 { |
50 { |
51 this->objectEditor.setObjectId(ldraw::NULL_ID); |
51 this->objectEditor->setObjectId(ldraw::NULL_ID); |
52 } |
52 } |
53 } |
53 } |