Pārlūkot izejas kodu

Added setParameterContainerEnabled in ctkCmdLineModuleFrontendQtGui

MattClarkson 12 gadi atpakaļ
vecāks
revīzija
1a2be75a4f

+ 14 - 0
Libs/CommandLineModules/Frontend/QtGui/ctkCmdLineModuleFrontendQtGui.cpp

@@ -206,3 +206,17 @@ QList<QString> ctkCmdLineModuleFrontendQtGui::parameterNames() const
   }
   return d->ParameterNames;
 }
+
+
+//-----------------------------------------------------------------------------
+void ctkCmdLineModuleFrontendQtGui::setParameterContainerEnabled(const bool& enabled)
+{
+  if (d->Widget == 0) return;
+
+  ctkCmdLineModuleObjectTreeWalker walker(d->Widget);
+  while(walker.readNextParameterContainer())
+  {
+    QVariant value(enabled);
+    walker.setValue(value, "enabled");
+  }
+}

+ 9 - 0
Libs/CommandLineModules/Frontend/QtGui/ctkCmdLineModuleFrontendQtGui.h

@@ -144,6 +144,15 @@ public:
 
   virtual QList<QString> parameterNames() const;
 
+  /**
+   * \brief There is a container QWidget within each group box, so you can
+   * set the container widget to enabled/disabled, thereby affecting all
+   * child widgets, without overwriting the enabled/disabled status of the
+   * child widget.
+   * @param enabled if true then enabled else disabled
+   */
+  virtual void setParameterContainerEnabled(const bool& enabled);
+
 protected:
 
   /**