File indexing completed on 2024-12-22 04:18:17
0001 /*************************************************************************** 0002 * * 0003 * copyright : (C) 2007 The University of Toronto * 0004 * netterfield@astro.utoronto.ca * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 ***************************************************************************/ 0012 0013 #ifndef COLORBUTTON_H 0014 #define COLORBUTTON_H 0015 0016 #include <QToolButton> 0017 0018 #include "kstwidgets_export.h" 0019 0020 namespace Kst { 0021 0022 class KSTWIDGETS_EXPORT ColorButton : public QToolButton { 0023 Q_OBJECT 0024 Q_PROPERTY(QColor color READ color WRITE setColor USER true) 0025 public: 0026 explicit ColorButton(QWidget *parent = 0); 0027 explicit ColorButton(const QColor &color, QWidget *parent = 0); 0028 virtual ~ColorButton(); 0029 0030 QColor color() const; 0031 bool colorDirty() const; 0032 0033 void clearSelection(); 0034 0035 public Q_SLOTS: 0036 void setColor(const QColor &color); 0037 0038 Q_SIGNALS: 0039 void changed(const QColor &color); 0040 0041 protected: 0042 virtual void paintEvent(QPaintEvent *event); 0043 0044 private Q_SLOTS: 0045 void chooseColor(); 0046 0047 private: 0048 QColor _color; 0049 }; 0050 0051 } 0052 0053 #endif 0054 0055 // vim: ts=2 sw=2 et