ctkColorPickerButton.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. All rights reserved.
  5. Distributed under a BSD License. See LICENSE.txt file.
  6. This software is distributed "AS IS" WITHOUT ANY WARRANTY; without even
  7. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the above copyright notice for more information.
  9. =========================================================================*/
  10. #ifndef __ctkColorPickerButton_h
  11. #define __ctkColorPickerButton_h
  12. // Qt includes
  13. #include <QPushButton>
  14. #include <QColor>
  15. // CTK includes
  16. #include "CTKWidgetsExport.h"
  17. class CTK_WIDGETS_EXPORT ctkColorPickerButton : public QPushButton
  18. {
  19. Q_OBJECT
  20. Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged USER true)
  21. public:
  22. explicit ctkColorPickerButton(QWidget* parent = 0);
  23. explicit ctkColorPickerButton(const QString& text, QWidget* parent = 0 );
  24. explicit ctkColorPickerButton(const QColor& color, const QString & text, QWidget* parent = 0 );
  25. virtual ~ctkColorPickerButton(){}
  26. QColor color()const;
  27. public slots:
  28. void setColor(const QColor& color);
  29. void changeColor(bool change = true);
  30. signals:
  31. void colorChanged(QColor);
  32. protected:
  33. QColor Color;
  34. };
  35. #endif