src/ui/canvas.cpp

changeset 73
97df974b5ed5
parent 71
198d25fe4e21
child 79
5fe2dd4e161a
equal deleted inserted replaced
72:7c27cda03747 73:97df974b5ed5
10 PartRenderer{model, documents, colorTable, parent} 10 PartRenderer{model, documents, colorTable, parent}
11 { 11 {
12 this->setMouseTracking(true); 12 this->setMouseTracking(true);
13 } 13 }
14 14
15 void Canvas::handleSelectionChange(const QSet<ldraw::Id>& selectedIds, const QSet<ldraw::Id>& deselectedIds) 15 void Canvas::handleSelectionChange(const QSet<ldraw::id_t>& selectedIds, const QSet<ldraw::id_t>& deselectedIds)
16 { 16 {
17 Q_ASSERT(not selectedIds.contains(ldraw::NULL_ID)); 17 Q_ASSERT(not selectedIds.contains(ldraw::NULL_ID));
18 this->selection.subtract(deselectedIds); 18 this->selection.subtract(deselectedIds);
19 this->selection.unite(selectedIds); 19 this->selection.unite(selectedIds);
20 this->compiler->setSelectedObjects(this->selection); 20 this->compiler->setSelectedObjects(this->selection);
21 this->update(); 21 this->update();
22 } 22 }
23 23
24 void Canvas::mouseMoveEvent(QMouseEvent* event) 24 void Canvas::mouseMoveEvent(QMouseEvent* event)
25 { 25 {
26 const ldraw::Id id = this->pick(event->pos()); 26 const ldraw::id_t id = this->pick(event->pos());
27 this->highlighted = id; 27 this->highlighted = id;
28 this->totalMouseMove += (event->pos() - this->lastMousePosition).manhattanLength(); 28 this->totalMouseMove += (event->pos() - this->lastMousePosition).manhattanLength();
29 this->worldPosition = this->screenToModelCoordinates(event->pos(), this->gridPlane); 29 this->worldPosition = this->screenToModelCoordinates(event->pos(), this->gridPlane);
30 if (this->worldPosition.has_value()) 30 if (this->worldPosition.has_value())
31 { 31 {

mercurial