KProperty

coloredit.h
1/* This file is part of the KDE project
2 Copyright (C) 2010-2016 Jarosław Staniek <staniek@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KPROPERTY_COLOREDIT_H
21#define KPROPERTY_COLOREDIT_H
22
23#include "KPropertyWidgetsFactory.h"
24
25//! Color combo box
26//! @todo enable transparency selection
27//! @todo add transparency option
28//! @todo reimplement view using KColorCells
29class KPROPERTYWIDGETS_EXPORT KPropertyColorComboEditor : public QWidget
30{
31 Q_OBJECT
32 Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
33
34public:
35 explicit KPropertyColorComboEditor(QWidget *parent = nullptr);
36
38
39 QVariant value() const;
40
42 void commitData( QWidget * editor );
43
44public Q_SLOTS:
45 void setValue(const QVariant &value);
46
47protected Q_SLOTS:
48 void slotValueChanged(const QColor&);
49
50protected:
51 bool eventFilter(QObject *o, QEvent *e) override;
52
53private:
54 Q_DISABLE_COPY(KPropertyColorComboEditor)
55 class Private;
56 Private * const d;
57};
58
59class KPROPERTYWIDGETS_EXPORT KPropertyColorComboDelegate : public KPropertyEditorCreatorInterface,
60 public KPropertyValuePainterInterface,
62{
63public:
64 KPropertyColorComboDelegate();
65 ~KPropertyColorComboDelegate() override;
66
67 QWidget *createEditor(int type, QWidget *parent, const QStyleOptionViewItem &option,
68 const QModelIndex &index) const override;
69
70 void paint(QPainter *painter, const QStyleOptionViewItem &option,
71 const QModelIndex &index) const override;
72
73 QString valueToString(const QVariant& value, const QLocale &locale) const override;
74
75private:
76 Q_DISABLE_COPY(KPropertyColorComboDelegate)
77 class Private;
78 Private * const d;
79};
80
81#endif
Color combo box.
Definition coloredit.h:30
An interface for editor widget creators.
Provides a specialized conversion of value to string depending on type.
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
virtual bool eventFilter(QObject *watched, QEvent *event)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:09 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.