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 { NotExpandable = 0, Expandable, Expanded };
27
28 virtual QTreeView *treeView() const = 0;
29
30 /// Should return true if the given row should be painted like a contained item(as opposed to label-rows etc.)
31 virtual bool indexIsItem(const QModelIndex &index) const = 0;
32
33 /// Does not request data from index, this only returns local data like highlighting for expanded rows and similar
34 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
35
36 /// Returns the match-color for the given index, or zero if match-quality could not be computed.
37 uint matchColor(const QModelIndex &index) const;
38
39protected:
40 /**
41 * @return the context-match quality from 0 to 10 if it could be determined, else -1
42 * */
43 virtual int contextMatchQuality(const QModelIndex &index) const = 0;
44};
45
46/**
47 * Helper-function to merge custom-highlighting variant-lists.
48 *
49 * @param strings A list of strings that should be merged
50 * @param highlights One variant-list for highlighting, as described in the kde header ktextedtor/codecompletionmodel.h
51 * @param gapBetweenStrings How many signs are inserted between 2 strings?
52 * */
53QList<QVariant> mergeCustomHighlighting(QStringList strings, QList<QVariantList> highlights, int gapBetweenStrings = 0);
54#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 Fri Oct 4 2024 12:03:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.