KTextEditor

expandingwidgetmodel.h
1/*
2 SPDX-FileCopyrightText: 2007 David Nolden <david.nolden.kdevelop@art-master.de>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef EXPANDING_WIDGET_MODEL_H
8#define EXPANDING_WIDGET_MODEL_H
9
10#include <QAbstractTableModel>
11#include <QIcon>
12#include <QPointer>
13
14class QTreeView;
15
16/**
17 * Cares about expanding/un-expanding items in a tree-view together with ExpandingDelegate
18 */
19// TODO: Merge this into KateCompletionModel
21{
22public:
24 ~ExpandingWidgetModel() override;
25
26 enum ExpandingType {
27 NotExpandable = 0,
28 Expandable,
29 Expanded
30 };
31
32 virtual QTreeView *treeView() const = 0;
33
34 /// Should return true if the given row should be painted like a contained item(as opposed to label-rows etc.)
35 virtual bool indexIsItem(const QModelIndex &index) const = 0;
36
37 /// Does not request data from index, this only returns local data like highlighting for expanded rows and similar
38 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
39
40 /// Returns the match-color for the given index, or zero if match-quality could not be computed.
41 uint matchColor(const QModelIndex &index) const;
42
43protected:
44 /**
45 * @return the context-match quality from 0 to 10 if it could be determined, else -1
46 * */
47 virtual int contextMatchQuality(const QModelIndex &index) const = 0;
48};
49
50/**
51 * Helper-function to merge custom-highlighting variant-lists.
52 *
53 * @param strings A list of strings that should be merged
54 * @param highlights One variant-list for highlighting, as described in the kde header ktextedtor/codecompletionmodel.h
55 * @param gapBetweenStrings How many signs are inserted between 2 strings?
56 * */
57QList<QVariant> mergeCustomHighlighting(QStringList strings, QList<QVariantList> highlights, int gapBetweenStrings = 0);
58#endif
Cares about expanding/un-expanding items in a tree-view together with ExpandingDelegate.
virtual int contextMatchQuality(const QModelIndex &index) const =0
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Does not request data from index, this only returns local data like highlighting for expanded rows an...
uint matchColor(const QModelIndex &index) const
Returns the match-color for the given index, or zero if match-quality could not be computed.
virtual bool indexIsItem(const QModelIndex &index) const =0
Should return true if the given row should be painted like a contained item(as opposed to label-rows ...
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
QObject * parent() const const
DisplayRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.