KProperty

coloredit.h
1 /* This file is part of the KDE project
2  Copyright (C) 2010-2016 Jarosław Staniek <[email protected]>
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 
29 class KPROPERTYWIDGETS_EXPORT KPropertyColorComboEditor : public QWidget
30 {
31  Q_OBJECT
32  Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
33 
34 public:
35  explicit KPropertyColorComboEditor(QWidget *parent = nullptr);
36 
37  ~KPropertyColorComboEditor() override;
38 
39  QVariant value() const;
40 
41 Q_SIGNALS:
42  void commitData( QWidget * editor );
43 
44 public Q_SLOTS:
45  void setValue(const QVariant &value);
46 
47 protected Q_SLOTS:
48  void slotValueChanged(const QColor&);
49 
50 protected:
51  bool eventFilter(QObject *o, QEvent *e) override;
52 
53 private:
55  class Private;
56  Private * const d;
57 };
58 
59 class KPROPERTYWIDGETS_EXPORT KPropertyColorComboDelegate : public KPropertyEditorCreatorInterface,
60  public KPropertyValuePainterInterface,
62 {
63 public:
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 
75 private:
76  Q_DISABLE_COPY(KPropertyColorComboDelegate)
77  class Private;
78  Private * const d;
79 };
80 
81 #endif
Color combo box.
Definition: coloredit.h:29
An interface for editor widget creators.
virtual bool eventFilter(QObject *watched, QEvent *event)
Q_PROPERTY(...)
Q_DISABLE_COPY(Class)
Provides a specialized conversion of value to string depending on type.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Aug 9 2020 23:10:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.