浏览代码

Merge branch 'ctkaxeswidget'

* ctkaxeswidget:
  Add designer plugin to ctkAxesWidget
Julien Finet 14 年之前
父节点
当前提交
5028b26726

+ 3 - 0
Libs/Widgets/Plugins/CMakeLists.txt

@@ -15,6 +15,8 @@ SET(PLUGIN_SRCS
 
   ctkActionsWidgetPlugin.cpp
   ctkActionsWidgetPlugin.h
+  ctkAxesWidgetPlugin.cpp
+  ctkAxesWidgetPlugin.h
   ctkCollapsibleButtonPlugin.cpp
   ctkCollapsibleButtonPlugin.h
   ctkCollapsibleGroupBoxPlugin.cpp
@@ -62,6 +64,7 @@ SET(PLUGIN_MOC_SRCS
   ctkWidgetsPlugins.h
 
   ctkActionsWidgetPlugin.h
+  ctkAxesWidgetPlugin.h
   ctkCollapsibleButtonPlugin.h
   ctkCollapsibleGroupBoxPlugin.h
   ctkColorPickerButtonPlugin.h

+ 67 - 0
Libs/Widgets/Plugins/ctkAxesWidgetPlugin.cpp

@@ -0,0 +1,67 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
+
+// CTK includes
+#include "ctkAxesWidgetPlugin.h"
+#include "ctkAxesWidget.h"
+
+//-----------------------------------------------------------------------------
+ctkAxesWidgetPlugin::ctkAxesWidgetPlugin(QObject *_parent) : QObject(_parent)
+{
+}
+
+//-----------------------------------------------------------------------------
+QWidget *ctkAxesWidgetPlugin::createWidget(QWidget *_parent)
+{
+  ctkAxesWidget* _widget = new ctkAxesWidget(_parent);
+  return _widget;
+}
+
+//-----------------------------------------------------------------------------
+QString ctkAxesWidgetPlugin::domXml() const
+{
+  return "<widget class=\"ctkAxesWidget\" \
+          name=\"AxesWidget\">\n"
+          "</widget>\n";
+}
+
+//-----------------------------------------------------------------------------
+QIcon ctkAxesWidgetPlugin::icon() const
+{
+  return QIcon(":/Icons/pushbutton.png");
+}
+
+//-----------------------------------------------------------------------------
+QString ctkAxesWidgetPlugin::includeFile() const
+{
+  return "ctkAxesWidget.h";
+}
+
+//-----------------------------------------------------------------------------
+bool ctkAxesWidgetPlugin::isContainer() const
+{
+  return false;
+}
+
+//-----------------------------------------------------------------------------
+QString ctkAxesWidgetPlugin::name() const
+{
+  return "ctkAxesWidget";
+}

+ 44 - 0
Libs/Widgets/Plugins/ctkAxesWidgetPlugin.h

@@ -0,0 +1,44 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
+
+#ifndef __ctkAxesWidgetPlugin_h
+#define __ctkAxesWidgetPlugin_h
+
+// CTK includes
+#include "ctkWidgetsAbstractPlugin.h"
+
+class CTK_WIDGETS_PLUGINS_EXPORT ctkAxesWidgetPlugin :
+  public QObject,
+  public ctkWidgetsAbstractPlugin
+{
+  Q_OBJECT
+
+public:
+  ctkAxesWidgetPlugin(QObject *_parent = 0);
+  
+  QWidget *createWidget(QWidget *_parent);
+  QString  domXml() const;
+  QIcon    icon() const;
+  QString  includeFile() const;
+  bool     isContainer() const;
+  QString  name() const;
+};
+
+#endif

+ 2 - 0
Libs/Widgets/Plugins/ctkWidgetsPlugins.h

@@ -27,6 +27,7 @@
 // CTK includes
 #include "ctkWidgetsPluginsExport.h"
 #include "ctkActionsWidgetPlugin.h"
+#include "ctkAxesWidgetPlugin.h"
 #include "ctkCollapsibleButtonPlugin.h"
 #include "ctkCollapsibleGroupBoxPlugin.h"
 #include "ctkColorPickerButtonPlugin.h"
@@ -59,6 +60,7 @@ public:
     {
     QList<QDesignerCustomWidgetInterface *> plugins;
     plugins << new ctkActionsWidgetPlugin
+            << new ctkAxesWidgetPlugin
             << new ctkCollapsibleButtonPlugin
             << new ctkCollapsibleGroupBoxPlugin
             << new ctkColorPickerButtonPlugin