src/ui/canvas.h

Fri, 07 Feb 2020 23:59:06 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Fri, 07 Feb 2020 23:59:06 +0200
changeset 51
1a9eac27698d
parent 47
cd6704009eb9
child 57
5c0005f63319
permissions
-rw-r--r--

selection works now

47
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #pragma once
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include "gl/partrenderer.h"
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 class Canvas : public PartRenderer
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 {
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 Q_OBJECT
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 public:
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 Canvas(
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 Model* model,
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 DocumentManager* documents,
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 const ldraw::ColorTable& colorTable,
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 QWidget* parent = nullptr);
51
1a9eac27698d selection works now
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
13 public slots:
1a9eac27698d selection works now
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
14 void handleSelectionChange(const QSet<ldraw::Id>& selectedIds, const QSet<ldraw::Id>& deselectedIds);
47
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 protected:
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 void mouseMoveEvent(QMouseEvent* event) override;
51
1a9eac27698d selection works now
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
17 void mousePressEvent(QMouseEvent* event) override;
1a9eac27698d selection works now
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
18 void mouseReleaseEvent(QMouseEvent* event) override;
47
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 signals:
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 void newStatusText(const QString& newStatusText);
51
1a9eac27698d selection works now
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
21 void selectionChanged(const QSet<ldraw::Id>& newSelection);
1a9eac27698d selection works now
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
22 private:
1a9eac27698d selection works now
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
23 QPoint lastMousePosition;
1a9eac27698d selection works now
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
24 int totalMouseMove = 0;
1a9eac27698d selection works now
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
25 QSet<ldraw::Id> selection;
47
cd6704009eb9 picking works now
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 };

mercurial