ctkWorkflowGroupBox.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkWorkflowGroupBox_h
  15. #define __ctkWorkflowGroupBox_h
  16. // Qt includes
  17. //#include <QGroupBox>
  18. #include <QWidget>
  19. class QString;
  20. class QVBoxLayout;
  21. class ctkWorkflowStep;
  22. // CTK includes
  23. #include "ctkPimpl.h"
  24. #include "ctkWidgetsExport.h"
  25. class ctkWorkflowGroupBoxPrivate;
  26. /// \ingroup Widgets
  27. /// \brief ctkWorkflowGroupBox is a widget displaying the user interface elements, title,
  28. /// description and/or error status of the current step of a ctkWorkflow.
  29. class CTK_WIDGETS_EXPORT ctkWorkflowGroupBox : public QWidget
  30. {
  31. Q_OBJECT
  32. Q_PROPERTY(QString preText READ preText WRITE setPreText)
  33. Q_PROPERTY(QString postText READ postText WRITE setPostText)
  34. /// This property controls the text, icon and tooltip of the title button.
  35. /// "{current:name}" by default.
  36. /// \sa titleFormat(), setTitleFormat(), ctkWorkflow::formatButton()
  37. Q_PROPERTY(QString titleFormat READ titleFormat WRITE setTitleFormat)
  38. /// This property controls the text of the subtitle view.
  39. /// "{current:description}" by default.
  40. /// \sa subTitleFormat(), setSubTitleFormat(), ctkWorkflow::formatButton(),
  41. /// titleFormat, errorTextFormat
  42. Q_PROPERTY(QString subTitleFormat READ subTitleFormat WRITE setSubTitleFormat)
  43. /// This property controls the textof the error view.
  44. /// "{current:statusText}" by default.
  45. /// \sa errorTextFormat(), setErrorTextFormat(), ctkWorkflow::formatButton(),
  46. /// titleFormat, subTitleFormat
  47. Q_PROPERTY(QString errorTextFormat READ errorTextFormat WRITE setErrorTextFormat)
  48. Q_PROPERTY(bool hideWidgetsOfNonCurrentSteps READ hideWidgetsOfNonCurrentSteps WRITE setHideWidgetsOfNonCurrentSteps)
  49. Q_PROPERTY(bool errorTextEnabled READ errorTextEnabled WRITE setErrorTextEnabled)
  50. public:
  51. typedef QWidget Superclass;
  52. explicit ctkWorkflowGroupBox(QWidget* parent = 0);
  53. virtual ~ctkWorkflowGroupBox();
  54. /// \brief Get the title text (usually a few words), located in the top area.
  55. ///
  56. /// Automatically displays the name of the ctkWorkflow's current step.
  57. QString title()const;
  58. /// \brief Set/get the subtitle text (usually a short sentence or two),
  59. /// located in the top area below the title.
  60. ///
  61. /// Automatically displays the description of the ctkWorkflow's current step.
  62. QString subTitle()const;
  63. /// \brief Set/get the pre-text, i.e. the contents of a convenience text
  64. /// section placed just above the client area.
  65. ///
  66. /// (Text is constant, regardless of the ctkWorkflow's current step).
  67. QString preText()const;
  68. void setPreText(const QString& newPreText);
  69. /// \brief Set/get the post-text, i.e. the contents of a convenience text
  70. /// section placed just below the client area.
  71. ///
  72. /// (Text is constant, regardless of the ctkWorkflow's current step).
  73. QString postText()const;
  74. void setPostText(const QString& newPostText);
  75. /// \brief Set/get the error text.
  76. ///
  77. /// Automatically displays the error text of the ctkWorkflow's current step.
  78. QString errorText()const;
  79. /// \brief Get the layout onto which step specific widgets are placed.
  80. QLayout* clientAreaLayout()const;
  81. /// Return the titleFormat property value.
  82. /// \sa titleFormat, setTitleFormat()
  83. QString titleFormat()const;
  84. /// Set the titleFormat property value.
  85. /// \sa titleFormat, titleFormat()
  86. void setTitleFormat(const QString& format);
  87. /// Return the subTitleFormat property value.
  88. /// \sa subTitleFormat, setSubTitleFormat()
  89. QString subTitleFormat()const;
  90. /// Set the subTitleFormat property value.
  91. /// \sa subTitleFormat, subTitleFormat()
  92. void setSubTitleFormat(const QString& format);
  93. /// Return the errorTextFormat property value.
  94. /// \sa errorTextFormat, setErrorTextFormat()
  95. QString errorTextFormat()const;
  96. /// Set the errorTextFormat property value.
  97. /// \sa errorTextFormat, errorTextFormat()
  98. void setErrorTextFormat(const QString& format);
  99. ///
  100. /// If hideWidgetsOfNonCurrentSteps is turned on, then a step's
  101. /// widgets will be hidden when that step is not the current step.
  102. /// If it is turned off, then they will be shown but disabled.
  103. /// (Default OFF).
  104. bool hideWidgetsOfNonCurrentSteps()const;
  105. void setHideWidgetsOfNonCurrentSteps(bool newHideWidgetsOfNonCurrentSteps);
  106. ///
  107. /// If errorTextEnabled is turned on, then a possible error text
  108. /// will be shown just underneath the client area.
  109. /// If it is turned off, then a possible error text will never
  110. /// be shown.
  111. /// (Default ON).
  112. bool errorTextEnabled()const;
  113. void setErrorTextEnabled(bool newErrorTextEnabled);
  114. public Q_SLOTS:
  115. virtual void updateGroupBox(ctkWorkflowStep* currentStep);
  116. protected:
  117. virtual void setSubTitle(const QString& newSubTitle);
  118. virtual void setErrorText(const QString& newErrorText);
  119. protected:
  120. QScopedPointer<ctkWorkflowGroupBoxPrivate> d_ptr;
  121. private:
  122. Q_DECLARE_PRIVATE(ctkWorkflowGroupBox);
  123. Q_DISABLE_COPY(ctkWorkflowGroupBox);
  124. };
  125. #endif