• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Kate

  • kde-4.14
  • applications
  • kate
  • part
  • snippet
snippetcompletionmodel.h
Go to the documentation of this file.
1 /* This file is part of the Kate project.
2  * Based on the snippet plugin from KDevelop 4.
3  *
4  * Copyright (C) 2008 Andreas Pakulat <apaku@gmx.de>
5  * Copyright (C) 2012 Christoph Cullmann <cullmann@kde.org>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef SNIPPETCOMPLETIONMODEL_H
24 #define SNIPPETCOMPLETIONMODEL_H
25 
26 #include <ktexteditor/codecompletionmodel.h>
27 #include <ktexteditor/codecompletionmodelcontrollerinterface.h>
28 
29 #include <QPointer>
30 
31 namespace KTextEditor
32 {
33 class Document;
34 class View;
35 }
36 
37 class SnippetCompletionItem;
38 
39 class SnippetCompletionModel : public KTextEditor::CodeCompletionModel2,
40  public KTextEditor::CodeCompletionModelControllerInterface3
41 {
42  Q_OBJECT
43  Q_INTERFACES(KTextEditor::CodeCompletionModelControllerInterface3)
44 
45 public:
46  SnippetCompletionModel();
47  ~SnippetCompletionModel();
48 
49  QVariant data( const QModelIndex& idx, int role = Qt::DisplayRole ) const;
50  void completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range,
51  KTextEditor::CodeCompletionModel::InvocationType invocationType);
52  virtual void executeCompletionItem2(KTextEditor::Document* document, const KTextEditor::Range& word,
53  const QModelIndex& index) const;
54  virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
55  virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
56  virtual QModelIndex parent(const QModelIndex& index) const;
57 
58  virtual KTextEditor::Range completionRange(KTextEditor::View* view, const KTextEditor::Cursor& position);
59  virtual bool shouldAbortCompletion(KTextEditor::View* view, const KTextEditor::Range& range, const QString& currentCompletion);
60 private:
61  void initData(KTextEditor::View* view);
62  QList<SnippetCompletionItem*> m_snippets;
63  QPointer<KTextEditor::View> m_viewToUse;
64 };
65 
66 #endif
QModelIndex
SnippetCompletionModel::rowCount
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: snippetcompletionmodel.cpp:148
SnippetCompletionModel::SnippetCompletionModel
SnippetCompletionModel()
Definition: snippetcompletionmodel.cpp:37
SnippetCompletionModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: snippetcompletionmodel.cpp:130
QPointer< KTextEditor::View >
SnippetCompletionModel::executeCompletionItem2
virtual void executeCompletionItem2(KTextEditor::Document *document, const KTextEditor::Range &word, const QModelIndex &index) const
Definition: snippetcompletionmodel.cpp:72
SnippetCompletionModel::shouldAbortCompletion
virtual bool shouldAbortCompletion(KTextEditor::View *view, const KTextEditor::Range &range, const QString &currentCompletion)
Definition: snippetcompletionmodel.cpp:180
SnippetCompletionModel::parent
virtual QModelIndex parent(const QModelIndex &index) const
Definition: snippetcompletionmodel.cpp:122
SnippetCompletionModel::data
QVariant data(const QModelIndex &idx, int role=Qt::DisplayRole) const
Definition: snippetcompletionmodel.cpp:49
SnippetCompletionModel::completionRange
virtual KTextEditor::Range completionRange(KTextEditor::View *view, const KTextEditor::Cursor &position)
Definition: snippetcompletionmodel.cpp:157
SnippetCompletionItem
Definition: snippetcompletionitem.h:41
SnippetCompletionModel::completionInvoked
void completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, KTextEditor::CodeCompletionModel::InvocationType invocationType)
Definition: snippetcompletionmodel.cpp:81
QString
QList< SnippetCompletionItem * >
SnippetCompletionModel
Definition: snippetcompletionmodel.h:39
SnippetCompletionModel::~SnippetCompletionModel
~SnippetCompletionModel()
Definition: snippetcompletionmodel.cpp:43
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal