File indexing completed on 2024-05-05 17:18:59
0001 /*************************************************************************** 0002 * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr 0003 * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 ***************************************************************************/ 0006 #ifndef SKGCOLORBUTTON_H 0007 #define SKGCOLORBUTTON_H 0008 /** @file 0009 * A color button with more features. 0010 * 0011 * @author Stephane MANKOWSKI / Guillaume DE BURE 0012 */ 0013 0014 #include "skgbasegui_export.h" 0015 #include "ui_skgcolorbutton.h" 0016 /** 0017 * This file is a color selector box with more features. 0018 */ 0019 class SKGBASEGUI_EXPORT SKGColorButton : public QWidget 0020 { 0021 Q_OBJECT 0022 /** 0023 * Text of the color selector 0024 */ 0025 Q_PROPERTY(QString text READ text WRITE setText NOTIFY changed USER true) 0026 /** 0027 * Color of the color selector 0028 */ 0029 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY changed) 0030 /** 0031 * Default color of the color selector 0032 */ 0033 Q_PROPERTY(QColor defaultColor READ defaultColor WRITE setDefaultColor NOTIFY changed) 0034 0035 public: 0036 /** 0037 * Default Constructor 0038 * @param iParent the parent 0039 */ 0040 explicit SKGColorButton(QWidget* iParent); 0041 0042 /** 0043 * Default Destructor 0044 */ 0045 ~SKGColorButton() override; 0046 0047 /** 0048 * Get the text for the color selector 0049 * @return the text 0050 */ 0051 virtual QString text() const; 0052 0053 0054 /** 0055 * Set the text for the color selector 0056 * @param iText the text 0057 */ 0058 virtual void setText(const QString& iText); 0059 0060 /** 0061 * Get the color for the color selector 0062 * @return the text 0063 */ 0064 virtual QColor color() const; 0065 0066 /** 0067 * Set the color for the color selector 0068 * @param iColor the color 0069 */ 0070 virtual void setColor(const QColor& iColor); 0071 0072 /** 0073 * Get the default color for the color selector 0074 * @return the text 0075 */ 0076 virtual QColor defaultColor() const; 0077 0078 0079 /** 0080 * Set the default color for the color selector 0081 * @param iColor the color 0082 */ 0083 virtual void setDefaultColor(const QColor& iColor); 0084 0085 Q_SIGNALS: 0086 /** 0087 * Emitted when the color is changed 0088 * @param iColor the color 0089 */ 0090 void changed(const QColor& iColor); 0091 0092 private: 0093 Ui::skgcolorbutton_base ui{}; 0094 QString m_text{}; 0095 }; 0096 0097 #endif // SKGCOLORBUTTON_H