KProperty

KPropertyEditorView.h
1 /* This file is part of the KDE project
2  Copyright (C) 2008-2018 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_EDITORVIEW_H
21 #define KPROPERTY_EDITORVIEW_H
22 
23 #include "kpropertywidgets_export.h"
24 
25 #include <QTreeView>
26 
27 class KProperty;
28 class KPropertySet;
30 
32 class KPROPERTYWIDGETS_EXPORT KPropertyEditorView : public QTreeView
33 {
34  Q_OBJECT
35 public:
37  explicit KPropertyEditorView(QWidget *parent = nullptr);
38 
39  ~KPropertyEditorView() override;
40 
42  enum class SetOption {
43  None = 0,
44  PreservePreviousSelection = 1,
45  AlphabeticalOrder = 2
47  };
48  Q_DECLARE_FLAGS(SetOptions, SetOption)
49 
50 
51  QColor gridLineColor() const;
52 
54  static QColor defaultGridLineColor() { return Qt::gray; }
55 
57  QSize sizeHint() const override;
58 
61  KPropertySet* propertySet() const;
62 
66  bool childPropertyItemsExpanded() const;
67 
70  bool isValueSyncEnabled() const;
71 
84  bool groupsVisible() const;
85 
90  bool groupItemsExpanded() const;
91 
102  bool toolTipsVisible() const;
103 
104 public Q_SLOTS:
110  void changeSet(KPropertySet *set, SetOptions options = SetOption::None);
111 
116  void changeSet(KPropertySet *set, const QByteArray& propertyToSelect, SetOptions options = SetOption::None);
117 
127  void setChildPropertyItemsExpanded(bool set);
128 
137  void setValueSyncEnabled(bool set);
138 
141  void acceptInput();
142 
144  void setGridLineColor(const QColor& color);
145 
149  void setGroupsVisible(bool set);
150 
160  void setGroupItemsExpanded(bool set);
161 
168  void setToolTipsVisible(bool set);
169 
170 Q_SIGNALS:
172  void propertySetChanged(KPropertySet *set);
173 
183  void handlePropertyEditorItemEvent(KPropertyEditorItemEvent *event);
184 
185 protected:
186  bool viewportEvent(QEvent * event) override;
187 
188 protected Q_SLOTS:
189  void currentChanged(const QModelIndex &current, const QModelIndex &previous) override;
190  void commitData(QWidget * editor) override;
191 
193  void slotSetWillBeCleared();
194 
196  void slotSetWillBeDeleted();
197 
200  void slotReadOnlyFlagChanged();
201 
203  void slotPropertyChanged(KPropertySet& set, KProperty& property);
204 
205  void slotPropertyReset(KPropertySet& set, KProperty& property);
206 
207 private:
209  void changeSetInternal(KPropertySet *set, SetOptions options, const QByteArray &propertyToSelect);
210  bool edit(const QModelIndex &index, EditTrigger trigger, QEvent *event) override;
211  void drawBranches(QPainter *painter, const QRect &rect, const QModelIndex &index) const override;
212 
214  void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
215 
216  void mousePressEvent(QMouseEvent *event) override;
217 
219  bool withinRevertButtonArea( int x, const QModelIndex& index ) const;
220 
223  QRect revertButtonArea( const QModelIndex& index ) const;
224 
226  void updateSubtree(const QModelIndex &index);
227 
229  void undo();
230 
231  Q_DISABLE_COPY(KPropertyEditorView)
232  class Private;
233  Private * const d;
234 };
235 
236 Q_DECLARE_OPERATORS_FOR_FLAGS(KPropertyEditorView::SetOptions)
237 
238 #endif
The KPropertyEditorItemEvent class describes request for handling a single property editor widget ite...
Set of properties.
Definition: KPropertySet.h:119
A widget for editing properties.
The base class representing a single property.
Definition: KProperty.h:95
SetOption
Options for changeSet()
static QColor defaultGridLineColor()
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Aug 9 2020 23:10:57 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.