-
Notifications
You must be signed in to change notification settings - Fork 3
/
qquickvtkinteractivewidget2.h
83 lines (64 loc) · 2.14 KB
/
qquickvtkinteractivewidget2.h
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*=========================================================================
Program: Visualization Toolkit
Module: QQuickVTKInteractiveWidget2.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class QQuickVTKInteractiveWidget2
* @brief QObject that manages a VTK interactive widget to ensure that it behaves as per the QtQuick
* threaded render loop.
*
* QQuickVTKInteractiveWidget2 holds a weak reference to the vtk widget it manages.
*/
#ifndef QQuickVTKInteractiveWidget2_h
#define QQuickVTKInteractiveWidget2_h
// Qt includes
#include <QObject>
// vtk includes
#include "vtkWeakPointer.h" // For vtkWeakPointer
#include "vtkGUISupportQtQuickModule.h" // for export macro
#include <vtkCameraOrientationWidget.h>
// Forward declarations
class vtkAbstractWidget;
class vtkRenderer;
class VTKGUISUPPORTQTQUICK_EXPORT QQuickVTKInteractiveWidget2 : public QObject
{
Q_OBJECT
typedef QObject Superclass;
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged);
public:
QQuickVTKInteractiveWidget2(QObject* parent = nullptr);
~QQuickVTKInteractiveWidget2() = default;
///@{
/**
* Set/Get the widget reference
*/
void setWidget(vtkAbstractWidget* w);
vtkAbstractWidget* widget() const;
///@}
///@{
/**
* Set/Get whether the widget is enabled.
*/
void setEnabled(bool e);
bool enabled() const;
///@}
public Q_SLOTS:
virtual void sync(vtkRenderer* ren);
Q_SIGNALS:
void enabledChanged(bool e);
protected:
// Helper members
vtkWeakPointer<vtkAbstractWidget> m_widget;
// Enabled/disabled
bool m_enabled = false;
private:
QQuickVTKInteractiveWidget2(const QQuickVTKInteractiveWidget2&) = delete;
void operator=(const QQuickVTKInteractiveWidget2) = delete;
};
#endif // QQuickVTKInteractiveWidget2_h