Browse Source

Hide the ctkCmdLineModuleQtComboBox impl in the custom UiLoader cpp file.

Sascha Zelzer 12 years ago
parent
commit
7edc072352

+ 4 - 2
Libs/CommandLineModules/Frontend/QtGui/CMakeLists.txt

@@ -17,17 +17,19 @@ set(KIT_SRCS
   ctkCmdLineModuleFrontendFactoryQtGui.cpp
   ctkCmdLineModuleFrontendFactoryQtGui.cpp
   ctkCmdLineModuleFrontendQtGui.cpp
   ctkCmdLineModuleFrontendQtGui.cpp
   ctkCmdLineModuleQtUiLoader.cpp
   ctkCmdLineModuleQtUiLoader.cpp
-  ctkCmdLineModuleQtComboBox.cpp
   ctkCmdLineModuleObjectTreeWalker_p.h
   ctkCmdLineModuleObjectTreeWalker_p.h
   ctkCmdLineModuleObjectTreeWalker.cpp
   ctkCmdLineModuleObjectTreeWalker.cpp
 )
 )
 
 
 # Headers that should run through moc
 # Headers that should run through moc
 set(KIT_MOC_SRCS
 set(KIT_MOC_SRCS
-  ctkCmdLineModuleQtComboBox_p.h
   ctkCmdLineModuleQtUiLoader.h
   ctkCmdLineModuleQtUiLoader.h
 )
 )
 
 
+qt4_generate_mocs(
+  ctkCmdLineModuleQtUiLoader.cpp
+)
+
 # UI files
 # UI files
 set(KIT_UI_FORMS
 set(KIT_UI_FORMS
 )
 )

+ 0 - 55
Libs/CommandLineModules/Frontend/QtGui/ctkCmdLineModuleQtComboBox.cpp

@@ -1,55 +0,0 @@
-/*=============================================================================
-
-  Library: CTK
-
-  Copyright (c) University College London
-
-  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.apache.org/licenses/LICENSE-2.0
-
-  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.
-
-=============================================================================*/
-
-#include "ctkCmdLineModuleQtComboBox_p.h"
-
-//-----------------------------------------------------------------------------
-ctkCmdLineModuleQtComboBox::ctkCmdLineModuleQtComboBox(QWidget *parent)
-: QComboBox(parent)
-{
-}
-
-
-//-----------------------------------------------------------------------------
-ctkCmdLineModuleQtComboBox::~ctkCmdLineModuleQtComboBox()
-{
-}
-
-
-//-----------------------------------------------------------------------------
-void ctkCmdLineModuleQtComboBox::setCurrentEnumeration(const QString& text)
-{
-  int i = findText(text);
-  if (i == -1)
-  {
-    i = this->currentIndex();
-  }
-  this->setCurrentIndex(i);
-}
-
-
-//-----------------------------------------------------------------------------
-QString ctkCmdLineModuleQtComboBox::currentEnumeration()const
-{
-  return this->currentText();
-}
-
-
-

+ 0 - 48
Libs/CommandLineModules/Frontend/QtGui/ctkCmdLineModuleQtComboBox_p.h

@@ -1,48 +0,0 @@
-/*=============================================================================
-
-  Library: CTK
-
-  Copyright (c) University College London
-
-  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.apache.org/licenses/LICENSE-2.0
-
-  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 CTKCMDLINEMODULEQTCOMBOBOX_H
-#define CTKCMDLINEMODULEQTCOMBOBOX_H
-
-#include <QComboBox>
-
-/**
- * \class ctkCmdLineModuleQtComboBox
- * \brief Private subclass of QComboBox, providing the currentEnumeration and setCurrentEnumeration methods.
- * \author m.clarkson@ucl.ac.uk
- * \ingroup CommandLineModulesFrontendQtGui
- */
-class ctkCmdLineModuleQtComboBox : public QComboBox
-{
-
-  Q_OBJECT
-  Q_PROPERTY(QString currentEnumeration READ currentEnumeration WRITE setCurrentEnumeration)
-
-public:
-
-  ctkCmdLineModuleQtComboBox(QWidget* parent = 0);
-  virtual ~ctkCmdLineModuleQtComboBox();
-
-  void setCurrentEnumeration(const QString& text);
-  QString currentEnumeration() const;
-
-};
-
-#endif // CTKCMDLINEMODULEQTCOMBOBOX_H

+ 38 - 6
Libs/CommandLineModules/Frontend/QtGui/ctkCmdLineModuleQtUiLoader.cpp

@@ -19,23 +19,53 @@
 =============================================================================*/
 =============================================================================*/
 
 
 #include "ctkCmdLineModuleQtUiLoader.h"
 #include "ctkCmdLineModuleQtUiLoader.h"
-#include "ctkCmdLineModuleQtComboBox_p.h"
+
+#include <QComboBox>
+
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-ctkCmdLineModuleQtUiLoader::ctkCmdLineModuleQtUiLoader(QObject *parent)
-  : QUiLoader(parent)
+/**
+ * \class ctkCmdLineModuleQtComboBox
+ * \brief Private subclass of QComboBox, providing the currentEnumeration and setCurrentEnumeration methods.
+ * \author m.clarkson@ucl.ac.uk
+ * \ingroup CommandLineModulesFrontendQtGui
+ */
+class ctkCmdLineModuleQtComboBox : public QComboBox
 {
 {
 
 
-}
+  Q_OBJECT
+  Q_PROPERTY(QString currentEnumeration READ currentEnumeration WRITE setCurrentEnumeration)
 
 
+public:
+
+  ctkCmdLineModuleQtComboBox(QWidget* parent = 0)
+    : QComboBox(parent)
+  {}
+
+  void setCurrentEnumeration(const QString& text)
+  {
+    int i = findText(text);
+    if (i == -1)
+    {
+      return;
+    }
+    this->setCurrentIndex(i);
+  }
+
+  QString currentEnumeration() const
+  {
+    return this->currentText();
+  }
+
+};
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-ctkCmdLineModuleQtUiLoader::~ctkCmdLineModuleQtUiLoader()
+ctkCmdLineModuleQtUiLoader::ctkCmdLineModuleQtUiLoader(QObject *parent)
+  : QUiLoader(parent)
 {
 {
 
 
 }
 }
 
 
-
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 QWidget* ctkCmdLineModuleQtUiLoader::createWidget(const QString& className, QWidget* parent, const QString& name)
 QWidget* ctkCmdLineModuleQtUiLoader::createWidget(const QString& className, QWidget* parent, const QString& name)
 {
 {
@@ -53,3 +83,5 @@ QWidget* ctkCmdLineModuleQtUiLoader::createWidget(const QString& className, QWid
 
 
   return widget;
   return widget;
 }
 }
+
+#include "moc_ctkCmdLineModuleQtUiLoader.cpp"

+ 0 - 1
Libs/CommandLineModules/Frontend/QtGui/ctkCmdLineModuleQtUiLoader.h

@@ -38,7 +38,6 @@ class CTK_CMDLINEMODULEQTGUI_EXPORT ctkCmdLineModuleQtUiLoader : public QUiLoade
 
 
 public:
 public:
   ctkCmdLineModuleQtUiLoader(QObject *parent=0);
   ctkCmdLineModuleQtUiLoader(QObject *parent=0);
-  virtual ~ctkCmdLineModuleQtUiLoader();
 
 
   /**
   /**
    * \brief If className is QComboBox, instantiates ctkCmdLineModuleQtGuiComboBox and
    * \brief If className is QComboBox, instantiates ctkCmdLineModuleQtGuiComboBox and