VTK
Q4VTKWidgetPlugin.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004 Sandia Corporation.
3  * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
4  * license for use of this work by or on behalf of the
5  * U.S. Government. Redistribution and use in source and binary forms, with
6  * or without modification, are permitted provided that this Notice and any
7  * statement of authorship are reproduced on all copies.
8  */
9 
10 /*========================================================================
11  For general information about using VTK and Qt, see:
12  http://www.trolltech.com/products/3rdparty/vtksupport.html
13 =========================================================================*/
14 
15 /*========================================================================
16  !!! WARNING for those who want to contribute code to this file.
17  !!! If you use a commercial edition of Qt, you can modify this code.
18  !!! If you use an open source version of Qt, you are free to modify
19  !!! and use this code within the guidelines of the GPL license.
20  !!! Unfortunately, you cannot contribute the changes back into this
21  !!! file. Doing so creates a conflict between the GPL and BSD-like VTK
22  !!! license.
23 =========================================================================*/
24 
25 #ifndef QVTK_WIDGET_PLUGIN
26 #define QVTK_WIDGET_PLUGIN
27 
28 // Disable warnings that Qt headers give.
29 #if defined(__GNUC__)
30 #pragma GCC diagnostic push
31 #pragma GCC diagnostic ignored "-Wunused-parameter"
32 #endif
33 
34 #include <QDesignerCustomWidgetInterface>
35 #include <QDesignerCustomWidgetCollectionInterface>
36 #include <QObject>
37 #include <QtPlugin>
38 #include <QWidget>
39 
40 // implement Designer Custom Widget interface
41 class QVTKWidgetPlugin : public QDesignerCustomWidgetInterface
42 {
43  public:
45  ~QVTKWidgetPlugin() override;
46 
47  QString name() const override;
48  QString domXml() const override;
49  QWidget* createWidget(QWidget* parent = 0) override;
50  QString group() const override;
51  QIcon icon() const override;
52  QString includeFile() const override;
53  QString toolTip() const override;
54  QString whatsThis() const override;
55  bool isContainer() const override;
56 };
57 
58 // implement designer widget collection interface
59 class QVTKPlugin : public QObject, public QDesignerCustomWidgetCollectionInterface
60 {
61  Q_OBJECT
62  #if QT_VERSION >= 0x050000
63  Q_PLUGIN_METADATA(IID "org.vtk.qvtkplugin")
64  #endif
65  Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
66  public:
67  QVTKPlugin();
68  ~QVTKPlugin() override;
69 
70  QList<QDesignerCustomWidgetInterface*> customWidgets() const override;
71  private:
72  QVTKWidgetPlugin* mQVTKWidgetPlugin;
73 };
74 
75 // fake QVTKWidget class to satisfy the designer
76 class QVTKWidget : public QWidget
77 {
78  Q_OBJECT
79 public:
80  QVTKWidget(QWidget* p) : QWidget(p) {}
81 };
82 
83 // Undo disabling of warning.
84 #if defined(__GNUC__)
85 #pragma GCC diagnostic pop
86 #endif
87 
88 #endif //QVTK_WIDGET_PLUGIN
QString group() const override
QString toolTip() const override
bool isContainer() const override
QString whatsThis() const override
QString includeFile() const override
QString domXml() const override
QString name() const override
QWidget * createWidget(QWidget *parent=0) override
QIcon icon() const override
QVTKWidget(QWidget *p)
display a vtkRenderWindow in a Qt&#39;s QWidget.
~QVTKWidgetPlugin() override