ctkCmdLineModuleFrontendQtGui.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef CTKCMDLINEMODULEFRONTENDQTGUI_H
  16. #define CTKCMDLINEMODULEFRONTENDQTGUI_H
  17. #include "ctkCmdLineModuleFrontend.h"
  18. #include "ctkCommandLineModulesFrontendQtGuiExport.h"
  19. class ctkCmdLineModuleReference;
  20. class ctkCmdLineModuleXslTransform;
  21. class QUiLoader;
  22. class QWidget;
  23. struct ctkCmdLineModuleFrontendQtGuiPrivate;
  24. /**
  25. * \class ctkCmdLineModuleFrontendQtGui
  26. * \brief A Qt based implementation of the module front end.
  27. * \ingroup CommandLineModulesFrontendQtGui
  28. */
  29. class CTK_CMDLINEMODULEQTGUI_EXPORT ctkCmdLineModuleFrontendQtGui : public ctkCmdLineModuleFrontend
  30. {
  31. public:
  32. ctkCmdLineModuleFrontendQtGui(const ctkCmdLineModuleReference& moduleRef);
  33. virtual ~ctkCmdLineModuleFrontendQtGui();
  34. // ctkCmdLineModuleFrontend overrides
  35. virtual QObject* guiHandle() const;
  36. /**
  37. * @brief Retrieves the current parameter value using the default QObject property for
  38. * parameter values.
  39. * @param parameter
  40. * @param role
  41. *
  42. * This implementation ignores the <code>role</code> argument and always returns
  43. * the value held by the default property, which usually correspongs to the
  44. * DisplayRole.
  45. *
  46. * @see ctkCmdLineModuleFrontend::value()
  47. */
  48. virtual QVariant value(const QString& parameter, int role = LocalResourceRole) const;
  49. /**
  50. * @brief Sets the parameter value.
  51. * @param parameter
  52. * @param value
  53. * @param role
  54. *
  55. * This implementation does nothing if the <code>role</code> parameter does not equal
  56. * ctkCmdLineModuleFrontend::DisplayRole. If it does, it sets the value of the default
  57. * QObject property to the provided value.
  58. *
  59. * @see ctkCmdLiineModuleFrontend::setValue()
  60. */
  61. virtual void setValue(const QString& parameter, const QVariant& value, int role = DisplayRole);
  62. virtual QList<QString> parameterNames() const;
  63. protected:
  64. virtual QUiLoader* uiLoader() const;
  65. virtual ctkCmdLineModuleXslTransform* xslTransform() const;
  66. QVariant customValue(const QString& parameter, const QString& propertyName = QString()) const;
  67. void setCustomValue(const QString& parameter, const QVariant& value, const QString& propertyName = QString()) ;
  68. private:
  69. QScopedPointer<ctkCmdLineModuleFrontendQtGuiPrivate> d;
  70. };
  71. #endif // CTKCMDLINEMODULEFRONTENDQTGUI_H