• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • interfaces
  • ktexteditor
codecompletionmodel.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
3  Copyright (C) 2005-2006 Hamish Rodda <rodda@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef KDELIBS_KTEXTEDITOR_CODECOMPLETIONMODEL_H
21 #define KDELIBS_KTEXTEDITOR_CODECOMPLETIONMODEL_H
22 
23 #include <ktexteditor/ktexteditor_export.h>
24 #include <QtCore/QModelIndex>
25 #include <ktexteditor/range.h>
26 
27 namespace KTextEditor {
28 
29 class Document;
30 class View;
31 
77 class KTEXTEDITOR_EXPORT CodeCompletionModel : public QAbstractItemModel
78 {
79  Q_OBJECT
80 
81  public:
82  CodeCompletionModel(QObject* parent);
83  virtual ~CodeCompletionModel();
84 
85  enum Columns {
86  Prefix = 0,
90  Icon,
91  Scope,
92  Name,
93  Arguments,
94  Postfix
95  };
96  static const int ColumnCount = Postfix + 1;
97 
98  enum CompletionProperty {
99  NoProperty = 0x0,
100  FirstProperty = 0x1,
101 
102  // Access specifiers - no more than 1 per item
103  Public = 0x1,
104  Protected = 0x2,
105  Private = 0x4,
106 
107  // Extra access specifiers - any number per item
108  Static = 0x8,
109  Const = 0x10,
110 
111  // Type - no more than 1 per item (except for Template)
112  Namespace = 0x20,
113  Class = 0x40,
114  Struct = 0x80,
115  Union = 0x100,
116  Function = 0x200,
117  Variable = 0x400,
118  Enum = 0x800,
119  Template = 0x1000,
120  TypeAlias = 0x2000,
121 
122  // Special attributes - any number per item
123  Virtual = 0x4000,
124  Override = 0x8000,
125  Inline = 0x10000,
126  Friend = 0x20000,
127  Signal = 0x40000,
128  Slot = 0x80000,
129 
130  // Scope - no more than 1 per item
131  LocalScope = 0x100000,
132  NamespaceScope = 0x200000,
133  GlobalScope = 0x400000,
134 
135  // Keep this in sync so the code knows when to stop
136  LastProperty = GlobalScope
137  };
138  Q_DECLARE_FLAGS(CompletionProperties, CompletionProperty)
139 
140  enum HighlightMethod {
141  NoHighlighting = 0x0,
142  InternalHighlighting = 0x1,
143  CustomHighlighting = 0x2
144  };
145  Q_DECLARE_FLAGS(HighlightMethods, HighlightMethod)
146 
147 
148 
149  enum ExtraItemDataRoles {
151  CompletionRole = Qt::UserRole,
152 
156  ScopeIndex,
157 
172  MatchQuality,
173 
182  SetMatchContext,
183 
189  HighlightingMethod,
190 
204  CustomHighlight,
205 
213  InheritanceDepth,
214 
220  IsExpandable,
245  ExpandingWidget,
253  ItemSelected,
254 
284  ArgumentHintDepth,
285 
295  BestMatchesCount,
296 
307  AccessibilityNext,
314  AccessibilityPrevious,
321  AccessibilityAccept,
322 
353  GroupRole
354  };
355  static const int LastItemDataRole = AccessibilityAccept;
356 
357  void setRowCount(int rowCount);
358 
359  enum InvocationType {
360  AutomaticInvocation,
361  UserInvocation,
362  ManualInvocation
363  };
364 
376  virtual void completionInvoked(KTextEditor::View* view, const KTextEditor::Range& range, InvocationType invocationType);
389  virtual void executeCompletionItem(Document* document, const Range& word, int row) const;
390 
391  // Reimplementations
396  virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
401  virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
408  virtual QMap<int, QVariant> itemData ( const QModelIndex & index ) const;
414  virtual QModelIndex parent ( const QModelIndex & index ) const;
421  virtual int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
422 
428  bool hasGroups() const;
429 
430  Q_SIGNALS:
431 
450  void waitForReset();
451 
455  void hasGroupsChanged(KTextEditor::CodeCompletionModel *model,bool hasGroups);
456 
457  protected:
458  void setHasGroups(bool hasGroups);
459 
460  private:
461  class CodeCompletionModelPrivate* const d;
462 };
463 
469 class KTEXTEDITOR_EXPORT CodeCompletionModel2 : public CodeCompletionModel {
470  Q_OBJECT
471  public:
472  CodeCompletionModel2(QObject* parent);
483  virtual void executeCompletionItem2(Document* document, const Range& word, const QModelIndex& index) const;
484 };
485 
486 Q_DECLARE_OPERATORS_FOR_FLAGS(CodeCompletionModel::CompletionProperties)
487 Q_DECLARE_OPERATORS_FOR_FLAGS(CodeCompletionModel::HighlightMethods)
488 
489 }
490 
491 #endif // KDELIBS_KTEXTEDITOR_CODECOMPLETIONMODEL_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Jul 23 2013 20:49:21 by doxygen 1.8.1.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

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

kdelibs-4.10.5 API Reference

Skip menu "kdelibs-4.10.5 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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