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__) && (__GNUC__>4) || (__GNUC__==4 && __GNUC_MINOR__>=6)
30 #pragma GCC diagnostic push
31 #endif
32 #if defined(__GNUC__)
33 #pragma GCC diagnostic ignored "-Wunused-parameter"
34 #endif
35 
36 #include <QDesignerCustomWidgetInterface>
37 #include <QDesignerCustomWidgetCollectionInterface>
38 #include <QObject>
39 #include <QtPlugin>
40 #include <QWidget>
41 
42 #include "vtkConfigure.h" //for VTK_OVERRIDE
43 
44 
45 // implement Designer Custom Widget interface
46 class QVTKWidgetPlugin : public QDesignerCustomWidgetInterface
47 {
48  public:
50  ~QVTKWidgetPlugin() VTK_OVERRIDE;
51 
52  QString name() const VTK_OVERRIDE;
53  QString domXml() const VTK_OVERRIDE;
54  QWidget* createWidget(QWidget* parent = 0) VTK_OVERRIDE;
55  QString group() const VTK_OVERRIDE;
56  QIcon icon() const VTK_OVERRIDE;
57  QString includeFile() const VTK_OVERRIDE;
58  QString toolTip() const VTK_OVERRIDE;
59  QString whatsThis() const VTK_OVERRIDE;
60  bool isContainer() const VTK_OVERRIDE;
61 };
62 
63 // implement designer widget collection interface
64 class QVTKPlugin : public QObject, public QDesignerCustomWidgetCollectionInterface
65 {
66  Q_OBJECT
67  #if QT_VERSION >= 0x050000
68  Q_PLUGIN_METADATA(IID "org.vtk.qvtkplugin")
69  #endif
70  Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
71  public:
72  QVTKPlugin();
73  ~QVTKPlugin() VTK_OVERRIDE;
74 
75  QList<QDesignerCustomWidgetInterface*> customWidgets() const VTK_OVERRIDE;
76  private:
77  QVTKWidgetPlugin* mQVTKWidgetPlugin;
78 };
79 
80 // fake QVTKWidget class to satisfy the designer
81 class QVTKWidget : public QWidget
82 {
83  Q_OBJECT
84 public:
85  QVTKWidget(QWidget* p) : QWidget(p) {}
86 };
87 
88 // Undo disabling of warning.
89 #if defined(__GNUC__) && (__GNUC__>4) || (__GNUC__==4 && __GNUC_MINOR__>=6)
90 #pragma GCC diagnostic pop
91 #endif
92 
93 #endif //QVTK_WIDGET_PLUGIN
QList< QDesignerCustomWidgetInterface * > customWidgets() const override
QString group() const override
QString toolTip() const override
bool isContainer() const override
QString whatsThis() const override
~QVTKPlugin() 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)
QVTKWidget displays a VTK window in a Qt window.
~QVTKWidgetPlugin() override