Просмотр исходного кода

Added the errorTextEnabled property of a ctkWorkflowGroupBox.

If errorTextEnabled is turned on, then a possible error text
will be shown just underneath the client area.
If it is turned off, then a possible error text will never
be shown. By default, this property is ON.

To enable python access to the groupbox of a workflowWidget, the
workflowGroupBox() method was marked as Q_INVOKABLE.
Daniel Haehn лет назад: 13
Родитель
Сommit
1a66cb7cf6

+ 6 - 1
Libs/Widgets/ctkWorkflowGroupBox.cpp

@@ -44,6 +44,7 @@ public:
   ~ctkWorkflowGroupBoxPrivate();
 
   bool HideWidgetsOfNonCurrentSteps;
+  bool ErrorTextEnabled;
 
   ctkWorkflowStep* StepShownPreviously;
   ctkWorkflowStep* StepShownCurrently;
@@ -59,6 +60,8 @@ ctkWorkflowGroupBoxPrivate::ctkWorkflowGroupBoxPrivate()
 {
   this->HideWidgetsOfNonCurrentSteps = false;
 
+  this->ErrorTextEnabled = true;
+
   this->StepShownPreviously = 0;
   this->StepShownCurrently = 0;
 }
@@ -93,6 +96,8 @@ ctkWorkflowGroupBox::~ctkWorkflowGroupBox()
 // --------------------------------------------------------------------------
 CTK_GET_CPP(ctkWorkflowGroupBox, bool, hideWidgetsOfNonCurrentSteps, HideWidgetsOfNonCurrentSteps);
 CTK_SET_CPP(ctkWorkflowGroupBox, bool, setHideWidgetsOfNonCurrentSteps, HideWidgetsOfNonCurrentSteps);
+CTK_GET_CPP(ctkWorkflowGroupBox, bool, errorTextEnabled, ErrorTextEnabled);
+CTK_SET_CPP(ctkWorkflowGroupBox, bool, setErrorTextEnabled, ErrorTextEnabled);
 CTK_GET_CPP(ctkWorkflowGroupBox, QLayout*, clientAreaLayout, ClientAreaLayout);
 
 // --------------------------------------------------------------------------
@@ -113,7 +118,7 @@ void ctkWorkflowGroupBox::updateGroupBox(ctkWorkflowStep* currentStep)
     d->SubTitleTextBrowser->setVisible(!this->subTitle().isEmpty());
     d->PreTextBrowser->setVisible(!this->preText().isEmpty());
     d->PostTextBrowser->setVisible(!this->postText().isEmpty());
-    d->ErrorTextBrowser->setVisible(!this->errorText().isEmpty());
+    d->ErrorTextBrowser->setVisible(!this->errorText().isEmpty() && d->ErrorTextEnabled);
     }
 
   // disable/hide the previously shown step

+ 10 - 0
Libs/Widgets/ctkWorkflowGroupBox.h

@@ -43,6 +43,7 @@ class CTK_WIDGETS_EXPORT ctkWorkflowGroupBox : public QWidget
   Q_PROPERTY(QString preText READ preText WRITE setPreText)
   Q_PROPERTY(QString postText READ postText WRITE setPostText)
   Q_PROPERTY(bool hideWidgetsOfNonCurrentSteps READ hideWidgetsOfNonCurrentSteps WRITE setHideWidgetsOfNonCurrentSteps)
+  Q_PROPERTY(bool errorTextEnabled READ errorTextEnabled WRITE setErrorTextEnabled)
 
 public:
 
@@ -91,6 +92,15 @@ public:
   bool hideWidgetsOfNonCurrentSteps()const;
   void setHideWidgetsOfNonCurrentSteps(bool newHideWidgetsOfNonCurrentSteps);
 
+  ///
+  /// If errorTextEnabled is turned on, then a possible error text
+  /// will be shown just underneath the client area.
+  /// If it is turned off, then a possible error text will never
+  /// be shown.
+  /// (Default ON).
+  bool errorTextEnabled()const;
+  void setErrorTextEnabled(bool newErrorTextEnabled);
+
 public slots:
 
   virtual void updateGroupBox(ctkWorkflowStep* currentStep);

+ 1 - 1
Libs/Widgets/ctkWorkflowWidget.h

@@ -56,7 +56,7 @@ public:
 
   /// Get the widget constaining the title, subtitle, pre-text, post-text, error-text and client area
   /// layout.
-  virtual ctkWorkflowGroupBox* workflowGroupBox()const;
+  Q_INVOKABLE virtual ctkWorkflowGroupBox* workflowGroupBox()const;
 
   /// Set/get whether or not to associate a buttonBoxWidget with this step (default true)
   bool showButtonBoxWidget()const;