KTextEditor

katestyletreewidget.h
1 /* SPDX-License-Identifier: LGPL-2.0-or-later
2 
3  Copyright (C) 2001-2003 Christoph Cullmann <[email protected]>
4  Copyright (C) 2002, 2003 Anders Lund <[email protected]>
5  Copyright (C) 2005-2006 Hamish Rodda <[email protected]>
6  Copyright (C) 2007 Mirko Stocker <[email protected]>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
23 
24 #ifndef KATESTYLETREEWIDGET_H
25 #define KATESTYLETREEWIDGET_H
26 
27 #include <QTreeWidget>
28 
29 #include "kateextendedattribute.h"
30 
37 {
38  Q_OBJECT
39 
40  friend class KateStyleListItem;
41 
42 public:
43  explicit KateStyleTreeWidget(QWidget *parent = nullptr, bool showUseDefaults = false);
44 
45  void emitChanged();
46 
47  void setBgCol(const QColor &c)
48  {
49  bgcol = c;
50  }
51  void setSelCol(const QColor &c)
52  {
53  selcol = c;
54  }
55  void setNormalCol(const QColor &c)
56  {
57  normalcol = c;
58  }
59 
61  void addItem(const QString &styleName, KTextEditor::Attribute::Ptr defaultstyle, KTextEditor::Attribute::Ptr data = KTextEditor::Attribute::Ptr());
62 
63  void resizeColumns();
64 
65 Q_SIGNALS:
66  void changed();
67 
68 protected:
69  void contextMenuEvent(QContextMenuEvent *event) override;
70  void showEvent(QShowEvent *event) override;
71  bool edit(const QModelIndex &index, EditTrigger trigger, QEvent *event) override;
72 
73 private Q_SLOTS:
74  void changeProperty();
75  void unsetColor();
76  void updateGroupHeadings();
77 
78 private:
79  QColor bgcol, selcol, normalcol;
80  QFont docfont;
81 };
82 
83 #endif
Q_SIGNALSQ_SIGNALS
QTreeWidget that automatically adds columns for KateStyleListItems and provides a popup menu and a sl...
Q_OBJECTQ_OBJECT
virtual bool event(QEvent *e) override
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun May 24 2020 23:10:49 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.