File indexing completed on 2024-11-24 04:34:17
0001 /*************************************************************************** 0002 * SPDX-License-Identifier: GPL-2.0-or-later 0003 * * 0004 * SPDX-FileCopyrightText: 2004-2019 Thomas Fischer <fischer@unix-ag.uni-kl.de> 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 * This program is distributed in the hope that it will be useful, * 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0014 * GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License * 0017 * along with this program; if not, see <https://www.gnu.org/licenses/>. * 0018 ***************************************************************************/ 0019 0020 #ifndef KBIBTEX_GUI_COLORLABELWIDGET_H 0021 #define KBIBTEX_GUI_COLORLABELWIDGET_H 0022 0023 #include <QComboBox> 0024 0025 #include <Value> 0026 0027 #include "kbibtexgui_export.h" 0028 0029 /** 0030 * @author Thomas Fischer <fischer@unix-ag.uni-kl.de> 0031 */ 0032 class KBIBTEXGUI_EXPORT ColorLabelWidget : public QComboBox 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 explicit ColorLabelWidget(QWidget *parent = nullptr); 0038 ~ColorLabelWidget() override; 0039 0040 void clear(); 0041 QColor currentColor() const; 0042 bool reset(const Value &value); 0043 bool apply(Value &value) const; 0044 bool validate(QWidget **widgetWithIssue, QString &message) const; 0045 void setReadOnly(bool); 0046 0047 static QPixmap createSolidIcon(const QColor &color); 0048 0049 Q_SIGNALS: 0050 void modified(); 0051 0052 private Q_SLOTS: 0053 void slotCurrentIndexChanged(int); 0054 0055 private: 0056 class ColorLabelWidgetPrivate; 0057 ColorLabelWidget::ColorLabelWidgetPrivate *d; 0058 }; 0059 0060 #endif // KBIBTEX_GUI_COLORLABELWIDGET_H