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 <QDesignerCustomWidgetCollectionInterface>
35 #include <QDesignerCustomWidgetInterface>
36 #include <QObject>
37 #include <QWidget>
38 #include <QtPlugin>
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
60  : public QObject
61  , public QDesignerCustomWidgetCollectionInterface
62 {
63  Q_OBJECT
64 #if QT_VERSION >= 0x050000
65  Q_PLUGIN_METADATA(IID "org.vtk.qvtkplugin")
66 #endif
67  Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
68 public:
69  QVTKPlugin();
70  ~QVTKPlugin() override;
71 
72  QList<QDesignerCustomWidgetInterface*> customWidgets() const override;
73 
74 private:
75  QVTKWidgetPlugin* mQVTKWidgetPlugin;
76 };
77 
78 // fake QVTKWidget class to satisfy the designer
79 class QVTKWidget : public QWidget
80 {
81  Q_OBJECT
82 public:
83  QVTKWidget(QWidget* p)
84  : QWidget(p)
85  {
86  }
87 };
88 
89 // Undo disabling of warning.
90 #if defined(__GNUC__)
91 #pragma GCC diagnostic pop
92 #endif
93 
94 #endif // QVTK_WIDGET_PLUGIN
QVTKPlugin::~QVTKPlugin
~QVTKPlugin() override
QVTKWidgetPlugin::domXml
QString domXml() const override
QVTKWidgetPlugin::whatsThis
QString whatsThis() const override
QVTKWidgetPlugin::icon
QIcon icon() const override
QVTKWidgetPlugin::isContainer
bool isContainer() const override
QVTKWidgetPlugin::includeFile
QString includeFile() const override
QVTKWidgetPlugin::QVTKWidgetPlugin
QVTKWidgetPlugin()
QVTKWidget::QVTKWidget
QVTKWidget(QWidget *p)
Definition: Q4VTKWidgetPlugin.h:83
QVTKWidget
display a vtkRenderWindow in a Qt's QWidget.
Definition: Q4VTKWidgetPlugin.h:79
QVTKWidgetPlugin::~QVTKWidgetPlugin
~QVTKWidgetPlugin() override
QVTKPlugin::QVTKPlugin
QVTKPlugin()
QVTKPlugin
Definition: Q4VTKWidgetPlugin.h:59
QVTKWidgetPlugin::group
QString group() const override
QVTKPlugin::customWidgets
QList< QDesignerCustomWidgetInterface * > customWidgets() const override
QVTKWidgetPlugin
Definition: Q4VTKWidgetPlugin.h:41
QVTKWidgetPlugin::createWidget
QWidget * createWidget(QWidget *parent=0) override
QVTKWidgetPlugin::toolTip
QString toolTip() const override
QVTKWidgetPlugin::name
QString name() const override