File indexing completed on 2024-05-12 04:52:51
0001 /* 0002 SPDX-FileCopyrightText: 2010 Till Theato <root@ttill.de> 0003 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 */ 0005 0006 #pragma once 0007 0008 #include "abstractparamwidget.hpp" 0009 #include <QWidget> 0010 0011 class KColorButton; 0012 class ChooseColorWidget; 0013 0014 /** @class ColorEditWidget 0015 @brief Provides options to choose a color. 0016 Two mechanisms are provided: color-picking directly on the screen and choosing from a list 0017 @author Till Theato 0018 */ 0019 class ColorEditWidget : public AbstractParamWidget 0020 { 0021 Q_OBJECT 0022 public: 0023 /** @brief Sets up the widget. 0024 */ 0025 explicit ColorEditWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent); 0026 0027 /** @brief Gets the chosen color. */ 0028 QString getColor() const; 0029 0030 private: 0031 ChooseColorWidget *m_choosecolor; 0032 0033 public Q_SLOTS: 0034 /** @brief Toggle the comments on or off 0035 */ 0036 void slotShowComment(bool show) override; 0037 0038 /** @brief refresh the properties to reflect changes in the model 0039 */ 0040 void slotRefresh() override; 0041 0042 /** @brief Updates the different color choosing options to have all selected @param color. */ 0043 void setColor(const QColor &color); 0044 0045 Q_SIGNALS: 0046 /** @brief Emitted whenever a different color was chosen. */ 0047 void modified(QColor = QColor()); 0048 };