Changeset View
Changeset View
Standalone View
Standalone View
src/include/ktexteditor/annotationinterface.h
Show All 25 Lines | |||||
26 | #include <QObject> | 26 | #include <QObject> | ||
27 | 27 | | |||
28 | class QMenu; | 28 | class QMenu; | ||
29 | 29 | | |||
30 | namespace KTextEditor | 30 | namespace KTextEditor | ||
31 | { | 31 | { | ||
32 | 32 | | |||
33 | class View; | 33 | class View; | ||
34 | class AbstractAnnotationItemDelegate; | ||||
34 | 35 | | |||
35 | /** | 36 | /** | ||
36 | * \brief An model for providing line annotation information | 37 | * \brief An model for providing line annotation information | ||
37 | * | 38 | * | ||
38 | * \section annomodel_intro Introduction | 39 | * \section annomodel_intro Introduction | ||
39 | * | 40 | * | ||
40 | * AnnotationModel is a model-like interface that can be implemented | 41 | * AnnotationModel is a model-like interface that can be implemented | ||
41 | * to provide annotation information for each line in a document. It provides | 42 | * to provide annotation information for each line in a document. It provides | ||
Show All 13 Lines | 55 | { | |||
55 | Q_OBJECT | 56 | Q_OBJECT | ||
56 | public: | 57 | public: | ||
57 | 58 | | |||
58 | virtual ~AnnotationModel() {} | 59 | virtual ~AnnotationModel() {} | ||
59 | 60 | | |||
60 | enum { | 61 | enum { | ||
61 | GroupIdentifierRole = Qt::UserRole | 62 | GroupIdentifierRole = Qt::UserRole | ||
62 | }; | 63 | }; | ||
64 | // KF6: add AnnotationModelUserRole = Qt::UserRole + 0x100 | ||||
63 | 65 | | |||
64 | /** | 66 | /** | ||
65 | * data() is used to retrieve the information needed to present the | 67 | * data() is used to retrieve the information needed to present the | ||
66 | * annotation information from the annotation model. The provider | 68 | * annotation information from the annotation model. The provider | ||
67 | * should return useful information for the line and the data role. | 69 | * should return useful information for the line and the data role. | ||
68 | * | 70 | * | ||
69 | * The following roles are supported: | 71 | * The following roles are supported: | ||
70 | * - Qt::DisplayRole - a short display text to be placed in the border | 72 | * - Qt::DisplayRole - a short display text to be placed in the border | ||
71 | * - Qt::TooltipRole - a tooltip information, longer text possible | 73 | * - Qt::TooltipRole - a tooltip information, longer text possible | ||
72 | * - Qt::BackgroundRole - a brush to be used to paint the background on the border | 74 | * - Qt::BackgroundRole - a brush to be used to paint the background on the border | ||
73 | * - Qt::ForegroundRole - a brush to be used to paint the text on the border | 75 | * - Qt::ForegroundRole - a brush to be used to paint the text on the border | ||
74 | * - AnnotationModel::GroupIdentifierRole - a string which identifies a | 76 | * - AnnotationModel::GroupIdentifierRole - a string which identifies a | ||
75 | * group of items which will be highlighted on mouseover; return the same | 77 | * group of items which will be highlighted on mouseover; return the same | ||
76 | * string for all items in a group (KDevelop uses a VCS revision number, for example) | 78 | * string for all items in a group (KDevelop uses a VCS revision number, for example) | ||
77 | * | 79 | * | ||
78 | * | 80 | * | ||
79 | * \param line the line for which the data is to be retrieved | 81 | * \param line the line for which the data is to be retrieved | ||
80 | * \param role the role to identify which kind of annotation is to be retrieved | 82 | * \param role the role to identify which kind of annotation is to be retrieved | ||
81 | * | 83 | * | ||
82 | * \returns a QVariant that contains the data for the given role. | 84 | * \returns a QVariant that contains the data for the given role. | ||
83 | */ | 85 | */ | ||
84 | virtual QVariant data(int line, Qt::ItemDataRole role) const = 0; | 86 | virtual QVariant data(int line, Qt::ItemDataRole role) const = 0; //KF6: use int for role | ||
85 | 87 | | |||
86 | Q_SIGNALS: | 88 | Q_SIGNALS: | ||
87 | /** | 89 | /** | ||
88 | * The model should emit the signal reset() when the text of almost all | 90 | * The model should emit the signal reset() when the text of almost all | ||
89 | * lines changes. In most cases it is enough to call lineChanged(). | 91 | * lines changes. In most cases it is enough to call lineChanged(). | ||
90 | * | 92 | * | ||
91 | * \note Kate Part implementation details: Whenever reset() is emitted Kate | 93 | * \note Kate Part implementation details: Whenever reset() is emitted Kate | ||
92 | * Part iterates over all lines of the document. Kate Part searches | 94 | * Part iterates over all lines of the document. Kate Part searches | ||
▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 Line(s) | 239 | public: | |||
263 | * | 265 | * | ||
264 | * \param view the view to which the border belongs to | 266 | * \param view the view to which the border belongs to | ||
265 | * \param visible the current visibility state | 267 | * \param visible the current visibility state | ||
266 | */ | 268 | */ | ||
267 | virtual void annotationBorderVisibilityChanged(KTextEditor::View *view, bool visible) = 0; | 269 | virtual void annotationBorderVisibilityChanged(KTextEditor::View *view, bool visible) = 0; | ||
268 | 270 | | |||
269 | }; | 271 | }; | ||
270 | 272 | | |||
273 | class KTEXTEDITOR_EXPORT AnnotationViewInterfaceV2 : public AnnotationViewInterface | ||||
274 | { | ||||
275 | public: | ||||
276 | virtual ~AnnotationViewInterfaceV2() {} | ||||
277 | | ||||
278 | virtual KTextEditor::AbstractAnnotationItemDelegate* annotationItemDelegate() const = 0; | ||||
279 | virtual void setAnnotationItemDelegate(KTextEditor::AbstractAnnotationItemDelegate *delegate) = 0; | ||||
280 | | ||||
281 | virtual bool uniformAnnotationItemSizes() const = 0; | ||||
282 | virtual void setUniformItemSizes(bool enable) = 0; | ||||
dhaumann: Change trailing ':' to '.' | |||||
283 | }; | ||||
284 | | ||||
271 | } | 285 | } | ||
dhaumann: typo: fpr | |||||
272 | 286 | | |||
273 | Q_DECLARE_INTERFACE(KTextEditor::AnnotationInterface, "org.kde.KTextEditor.AnnotationInterface") | 287 | Q_DECLARE_INTERFACE(KTextEditor::AnnotationInterface, "org.kde.KTextEditor.AnnotationInterface") | ||
274 | Q_DECLARE_INTERFACE(KTextEditor::AnnotationViewInterface, "org.kde.KTextEditor.AnnotationViewInterface") | 288 | Q_DECLARE_INTERFACE(KTextEditor::AnnotationViewInterface, "org.kde.KTextEditor.AnnotationViewInterface") | ||
289 | Q_DECLARE_INTERFACE(KTextEditor::AnnotationViewInterfaceV2, "org.kde.KTextEditor.AnnotationViewInterfaceV2") | ||||
275 | 290 | | |||
276 | #endif | 291 | #endif | ||
277 | 292 | | |||
I think you don't need to type "\ref". doxygen will create the link for you anyways. Same below. dhaumann: I think you don't need to type "\ref". doxygen will create the link for you anyways. Same below. | |||||
... or a nullptr, if no delegate was set. maybe? I am asking, since it could also return some default implementation. dhaumann: ... or a nullptr, if no delegate was set. maybe? I am asking, since it could also return some… |
Change trailing ':' to '.'