KCompletion

kcompletionbase.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 1999, 2000 Carsten Pfeiffer <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KCOMPLETIONBASE_H
9 #define KCOMPLETIONBASE_H
10 
11 #include <kcompletion.h>
12 #include <kcompletion_export.h>
13 
14 #include <QMap>
15 #include <memory>
16 
17 class KCompletionBasePrivate;
18 
36 class KCOMPLETION_EXPORT KCompletionBase
37 {
38 public:
39  Q_DECLARE_PRIVATE(KCompletionBase)
61  SubstringCompletion
62  };
63 
64  // Map for the key binding types mentioned above.
66 
71 
75  virtual ~KCompletionBase();
76 
92  KCompletion *completionObject(bool handleSignals = true);
93 
110  virtual void setCompletionObject(KCompletion *completionObject, bool handleSignals = true);
111 
124  virtual void setHandleSignals(bool handle);
125 
136  bool isCompletionObjectAutoDeleted() const;
137 
147  void setAutoDeleteCompletionObject(bool autoDelete);
148 
169  void setEnableSignals(bool enable);
170 
176  bool handleSignals() const;
177 
183  bool emitSignals() const;
184 
190  void setEmitSignals(bool emitRotationSignals);
191 
198  virtual void setCompletionMode(KCompletion::CompletionMode mode);
199 
205  KCompletion::CompletionMode completionMode() const;
206 
236  bool setKeyBinding(KeyBindingType item, const QList<QKeySequence> &key);
237 
251  QList<QKeySequence> keyBinding(KeyBindingType item) const;
252 
253 #if KCOMPLETION_ENABLE_DEPRECATED_SINCE(5, 0)
254 
257  KCOMPLETION_DEPRECATED_VERSION(5, 0, "Use KCompletionBase::keyBinding(KeyBindingType)")
258  QList<QKeySequence> getKeyBinding(KeyBindingType item) const
259  {
260  return keyBinding(item);
261  }
262 #endif
263 
275  void useGlobalKeyBindings();
276 
291  virtual void setCompletedText(const QString &text) = 0;
292 
300  virtual void setCompletedItems(const QStringList &items, bool autoSuggest = true) = 0;
301 
313  KCompletion *compObj() const;
314 
315 protected:
325  KeyBindingMap keyBindingMap() const;
326 
327 #if KCOMPLETION_ENABLE_DEPRECATED_SINCE(5, 0)
328 
331  KCOMPLETION_DEPRECATED_VERSION(5, 0, "Use KCompletionBase::keyBindingMap()")
332  KeyBindingMap getKeyBindings() const
333  {
334  return keyBindingMap();
335  }
336 #endif
337 
343  void setKeyBindingMap(KeyBindingMap keyBindingMap);
344 
350  void setDelegate(KCompletionBase *delegate);
351 
357  KCompletionBase *delegate() const;
358 
362  virtual void virtual_hook(int id, void *data);
363 
364 private:
365  Q_DISABLE_COPY(KCompletionBase)
366  std::unique_ptr<KCompletionBasePrivate> const d_ptr;
367 };
368 
369 #endif // KCOMPLETIONBASE_H
Switch to next completion (by default Ctrl-Down).
Text completion (by default Ctrl-E).
Switch to previous completion (by default Ctrl-Up).
CompletionMode
This enum describes the completion mode used for by the KCompletion class.
Definition: kcompletion.h:130
A generic class for completing QStrings.
Definition: kcompletion.h:116
An abstract base class for adding a completion feature into widgets.
KeyBindingType
Constants that represent the items whose shortcut key binding is programmable.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 23 2021 03:04:08 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.