ctkSettingsPanel.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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.commontk.org/LICENSE
  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 __ctkSettingsPanel_h
  15. #define __ctkSettingsPanel_h
  16. // Qt includes
  17. #include <QWidget>
  18. // CTK includes
  19. #include "ctkWidgetsExport.h"
  20. class QSettings;
  21. class ctkSettingsPanelPrivate;
  22. class CTK_WIDGETS_EXPORT ctkSettingsPanel : public QWidget
  23. {
  24. Q_OBJECT
  25. public:
  26. /// Superclass typedef
  27. typedef QWidget Superclass;
  28. /// Constructor
  29. explicit ctkSettingsPanel(QWidget* parent = 0);
  30. /// Destructor
  31. virtual ~ctkSettingsPanel();
  32. QSettings* settings()const;
  33. void setSettings(QSettings* settings);
  34. void registerProperty(const QString& key,
  35. QObject* object,
  36. const QString& property,
  37. const char* signal);
  38. signals:
  39. void settingChanged(const QString& key, const QVariant& value);
  40. protected slots:
  41. void updateSetting(const QString& key);
  42. protected:
  43. QScopedPointer<ctkSettingsPanelPrivate> d_ptr;
  44. virtual void updateProperties();
  45. private:
  46. Q_DECLARE_PRIVATE(ctkSettingsPanel);
  47. Q_DISABLE_COPY(ctkSettingsPanel);
  48. };
  49. #endif