-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickVtkViewer.h
More file actions
62 lines (46 loc) · 1.54 KB
/
quickVtkViewer.h
File metadata and controls
62 lines (46 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once
#include "QQuickVtkItem.h"
#include "quickVtkDispatcher.h"
#include "quickVtkObject.h"
class vtkRenderer;
#include <QtQml/QQmlListProperty>
#include <QtCore/QList>
#include <QtCore/QPointF>
#include <QtCore/QAtomicInteger>
#include <QtCore/QAtomicPointer>
#include <private/qquickevents_p_p.h> // for QQuickMouseEvent
namespace quick { namespace vtk {
class Viewer : public QQuickVtkItem, public Dispatcher, public SharedData
{
Q_OBJECT
Q_CLASSINFO("DefaultProperty", "input");
public:
Viewer(QQuickItem* parent=nullptr);
~Viewer() override;
// QQuickVtkItem interface
using vtkUserData = vtkSmartPointer<vtkObject>;
vtkUserData initializeVTK(vtkRenderWindow*) override;
// Dispatcher interface
void dispatch_async(std::function<void(vtkRenderWindow*, vtkUserData)>, SharedData*) override;
bool map(QObject*, vtkUserData, vtkUserData) override;
bool unmap(QObject*, vtkUserData) override;
vtkUserData lookup(QObject*, vtkUserData, bool mightBeEmpty=false) override;
vtkRenderer* myVtkObject(vtkUserData);
bool isVolatile() const;
// input property
Q_PROPERTY(QQmlListProperty<quick::vtk::Object> input READ input NOTIFY inputChanged);
QQmlListProperty<Object> input();
Q_SIGNAL void inputChanged();
QList<Object*> m_input;
signals:
void clicked(QQuickMouseEvent * mouse);
private:
bool event(QEvent*) override;
private:
struct {
Qt::MouseButton button = Qt::NoButton;
QPointF localPos;
} m_click;
QQuickMouseEvent m_quickMouseEvent;
};
}}