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