Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtGui.QCompleter Class Reference

The QCompleter class provides completions based on an item model. More...

Inheritance diagram for QtGui.QCompleter:
Collaboration diagram for QtGui.QCompleter:

Public Types

enum  CompletionMode { InlineCompletion = 2, PopupCompletion = 0, UnfilteredPopupCompletion = 1 }
  More...
 
enum  ModelSorting { CaseInsensitivelySortedModel = 2, CaseSensitivelySortedModel = 1, UnsortedModel = 0 }
  More...
 

Public Member Functions

 QCompleter (QObject parent=null)
 
 
 QCompleter (QAbstractItemModel model, QObject parent=null)
 
 
 QCompleter (System.Collections.Generic.List< string > completions, QObject parent=null)
 
 
override void CreateProxy ()
 
new void Complete ()
 
 
new void Complete (QRect rect)
 
 
new int CompletionCount ()
 
 
new QAbstractItemModel CompletionModel ()
 
 
new string CurrentCompletion ()
 
 
new QModelIndex CurrentIndex ()
 
 
new int CurrentRow ()
 
 
override bool OnEvent (QEvent arg1)
 
 
override bool EventFilter (QObject o, QEvent e)
 
 
virtual string PathFromIndex (QModelIndex index)
 
 
new bool SetCurrentRow (int row)
 
 
virtual
System.Collections.Generic.List
< string > 
SplitPath (string path)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
 
 
new bool BlockSignals (bool b)
 
 
new
System.Collections.Generic.List
< QObject
Children ()
 
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
new void DeleteLater ()
 
 
new bool Disconnect (QObject receiver, string member=null)
 
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
 
 
new void DumpObjectInfo ()
 
 
new void DumpObjectTree ()
 
 
new
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames ()
 
 
new bool Inherits (string classname)
 
 
new void InstallEventFilter (QObject arg1)
 
 
new bool IsWidgetType ()
 
 
new void KillTimer (int id)
 
 
new object Property (string name)
 
 
new void RemoveEventFilter (QObject arg1)
 
 
new bool SetProperty (string name, object value)
 
 
new void SetUserData (uint id, QObjectUserData data)
 
new bool SignalsBlocked ()
 
 
new int StartTimer (int interval)
 
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 

Static Public Member Functions

static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QObject
static bool Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType arg5=Qt.ConnectionType.AutoConnection)
 
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
 
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
 
 
static uint RegisterUserData ()
 
static string Tr (string s, string c=null)
 
 
static string Tr (string s, string c, int n)
 
 
static string TrUtf8 (string s, string c=null)
 
 
static string TrUtf8 (string s, string c, int n)
 
 
- Static Public Member Functions inherited from QtCore.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream arg1, QSizeF arg2)
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream arg1, QPoint arg2)
 
static QDataStream Write (QDataStream arg1, QLineF arg2)
 
static QDataStream Write (QDataStream arg1, QPointF arg2)
 
static QDataStream Write (QDataStream arg1, QChar arg2)
 
static QDataStream Write (QDataStream arg1, QByteArray arg2)
 
static QDataStream Write (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Write (QDataStream arg1, QRectF arg2)
 
static QDataStream Write (QDataStream arg1, QDateTime arg2)
 
static QDataStream Write (QDataStream arg1, QUrl arg2)
 
static QDataStream Write (QDataStream arg1, QTime arg2)
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream arg1, QBitArray arg2)
 
static QDataStream Write (QDataStream arg1, QUuid arg2)
 
static QDataStream Write (QDataStream arg1, QLine arg2)
 
static QDataStream Write (QDataStream arg1, QDate arg2)
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
 
static QDataStream Write (QDataStream arg1, QRect arg2)
 
static QDataStream Write (QDataStream arg1, QSize arg2)
 
static QDataStream Write (QDataStream s, QVariant.Type p)
 
static QDataStream Write (QDataStream arg1, string arg2)
 
static QDataStream Write (QDataStream @out, System.Collections.Generic.List< string > list)
 
static QDataStream Read (QDataStream arg1, QChar arg2)
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream arg1, QRect arg2)
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream arg1, QDate arg2)
 
static QDataStream Read (QDataStream arg1, QUrl arg2)
 
static QDataStream Read (QDataStream arg1, QUuid arg2)
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream arg1, QLineF arg2)
 
static QDataStream Read (QDataStream arg1, QRectF arg2)
 
static QDataStream Read (QDataStream arg1, QPointF arg2)
 
static QDataStream Read (QDataStream arg1, QLine arg2)
 
static QDataStream Read (QDataStream arg1, QBitArray arg2)
 
static QDataStream Read (QDataStream arg1, QSize arg2)
 
static QDataStream Read (QDataStream arg1, QDateTime arg2)
 
static QDataStream Read (QDataStream arg1, QTime arg2)
 
static QDataStream Read (QDataStream arg1, QPoint arg2)
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream arg1, QByteArray arg2)
 
static QDataStream Read (QDataStream arg1, QSizeF arg2)
 
static QDataStream Read (QDataStream arg1, string arg2)
 
static QDataStream Read (QDataStream s, QVariant.Type p)
 
static QDataStream Read (QDataStream @in, System.Collections.Generic.List< string > list)
 
static double qAcos (double v)
 
static void qAddPostRoutine (System.Action arg1)
 
static string qAppName ()
 
static double qAsin (double v)
 
static double qAtan (double v)
 
static double qAtan2 (double x, double y)
 
static void qBadAlloc ()
 
static int qCeil (double v)
 
static ushort qChecksum (string s, uint len)
 
static QByteArray qCompress (QByteArray data)
 
static QByteArray qCompress (QByteArray data, int compressionLevel=-1)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
 
static double qCos (double v)
 
static double qExp (double v)
 
static double qFabs (double v)
 
static double qFastCos (double x)
 
static double qFastSin (double x)
 
static string qFlagLocation (string method)
 
static int qFloor (double v)
 
static bool qFuzzyCompare (double p1, double p2)
 
static bool qFuzzyCompare (float p1, float p2)
 
static bool qFuzzyIsNull (double d)
 
static bool qFuzzyIsNull (float f)
 
static uint qHash (QBitArray key)
 
static uint qHash (QChar key)
 
static uint qHash (QStringRef key)
 
static uint qHash (QUrl url)
 
static uint qHash (QPersistentModelIndex index)
 
static uint qHash (QByteArray key)
 
static uint qHash (QModelIndex index)
 
static uint qHash (uint key)
 
static uint qHash (sbyte key)
 
static uint qHash (byte key)
 
static uint qHash (short key)
 
static uint qHash (NativeLong key)
 
static uint qHash (ushort key)
 
static uint qHash (long key)
 
static uint qHash (ulong key)
 
static uint qHash (int key)
 
static uint qHash (string key)
 
static uint qHash (NativeULong key)
 
static double qInf ()
 
static Qt.ActionQtMsgTypeString qInstallMsgHandler (Qt.ActionQtMsgTypeString arg1)
 
static int qIntCast (float f)
 
static int qIntCast (double f)
 
static bool qIsFinite (double d)
 
static bool qIsFinite (float f)
 
static bool qIsInf (float f)
 
static bool qIsInf (double d)
 
static bool qIsNaN (float f)
 
static bool qIsNaN (double d)
 
static bool qIsNull (float f)
 
static bool qIsNull (double d)
 
static double qLn (double v)
 
static double qPow (double x, double y)
 
static double qQNaN ()
 
static void qRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
 
static void qRemovePostRoutine (System.Action arg1)
 
static int qRound (double d)
 
static long qRound64 (double d)
 
static double qSNaN ()
 
static bool qSharedBuild ()
 
static double qSin (double v)
 
static double qSqrt (double v)
 
static bool qStringComparisonHelper (QStringRef s1, string s2)
 
static double qTan (double v)
 
static QByteArray qUncompress (QByteArray data)
 
static QByteArray qUncompress (Pointer< byte > data, int nbytes)
 
static string qVersion ()
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
 
static bool Qputenv (string varName, QByteArray value)
 
static int Qrand ()
 
static void Qsrand (uint seed)
 
static int Qstrcmp (QByteArray str1, QByteArray str2)
 
static int Qstrcmp (QByteArray str1, string str2)
 
static int Qstrcmp (string str1, QByteArray str2)
 
static int Qstrcmp (string str1, string str2)
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
 
static Pointer< sbyte > Qstrdup (string arg1)
 
static int Qstricmp (string arg1, string arg2)
 
static uint Qstrlen (string str)
 
static int Qstrncmp (string str1, string str2, uint len)
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
 
static int Qstrnicmp (string arg1, string arg2, uint len)
 
static uint Qstrnlen (string str, uint maxlen)
 
static string QtTrId (string id, int n=-1)
 

Protected Member Functions

 QCompleter (System.Type dummy)
 
new void OnActivated (QModelIndex index)
 
 
new void OnActivated (string text)
 
 
new void OnHighlighted (QModelIndex index)
 
 
new void OnHighlighted (string text)
 
 
- Protected Member Functions inherited from QtCore.QObject
 QObject (System.Type dummy)
 
virtual void OnChildEvent (QChildEvent arg1)
 
 
virtual void ConnectNotify (string signal)
 
 
virtual void OnCustomEvent (QEvent arg1)
 
 
new void OnDestroyed (QObject arg1=null)
 
 
virtual void DisconnectNotify (string signal)
 
 
new int Receivers (string signal)
 
 
new QObject Sender ()
 
 
new int SenderSignalIndex ()
 
 
virtual void OnTimerEvent (QTimerEvent arg1)
 
 

Properties

Slot< System.String > Activated
 
 
Slot< QModelIndexActivatedIndex
 
Slot< System.String > Highlighted
 
 
Slot< QModelIndexHighlightedIndex
 
new QAbstractItemModel Model [get, set]
 
 
new QAbstractItemView Popup [get, set]
 
 
new QWidget Widget [get, set]
 
 
new string CompletionPrefix [get, set]
 
 
new ModelSorting modelSorting [get, set]
 
 
new CompletionMode completionMode [get, set]
 
 
new int CompletionColumn [get, set]
 
 
new int CompletionRole [get, set]
 
 
new int MaxVisibleItems [get, set]
 
 
new Qt.CaseSensitivity CaseSensitivity [get, set]
 
 
new bool WrapAround [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQCompleterSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
 
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
 
 
Slot< QObjectDestroyedQObject
 
Slot Destroyed
 
 
new QObject Parent [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 

Additional Inherited Members

- Protected Attributes inherited from QtCore.QObject
object Q_EMIT = null
 
SmokeInvocation interceptor
 
readonly List< QEventHandler > eventFilters = new List<QEventHandler>()
 

Detailed Description

The QCompleter class provides completions based on an item model.

You can use QCompleter to provide auto completions in any Qt widget, such as QLineEdit and QComboBox. When the user starts typing a word, QCompleter suggests possible ways of completing the word, based on a word list. The word list is provided as a QAbstractItemModel. (For simple applications, where the word list is static, you can pass a QStringList to QCompleter's constructor.)

Basic Usage

A QCompleter is used typically with a QLineEdit or QComboBox. For example, here's how to provide auto completions from a simple word list in a QLineEdit:

QStringList wordList;

wordList << "alpha" << "omega" << "omicron" << "zeta";

QLineEdit *lineEdit = new QLineEdit(this);

QCompleter *completer = new QCompleter(wordList, this);

completer->setCaseSensitivity(Qt::CaseInsensitive);

lineEdit->setCompleter(completer);

A QFileSystemModel can be used to provide auto completion of file names. For example:

QCompleter *completer = new QCompleter(this);

completer->setModel(new QDirModel(completer));

lineEdit->setCompleter(completer);

To set the model on which QCompleter should operate, call setModel(). By default, QCompleter will attempt to match the completion prefix (i.e., the word that the user has started typing) against the Qt::EditRole data stored in column 0 in the model case sensitively. This can be changed using setCompletionRole(), setCompletionColumn(), and setCaseSensitivity().

If the model is sorted on the column and role that are used for completion, you can call setModelSorting() with either QCompleter::CaseSensitivelySortedModel or QCompleter::CaseInsensitivelySortedModel as the argument. On large models, this can lead to significant performance improvements, because QCompleter can then use binary search instead of linear search.

The model can be a list model, a table model, or a tree model. Completion on tree models is slightly more involved and is covered in the Handling Tree Models section below.

The completionMode() determines the mode used to provide completions to the user.

Iterating Through Completions

To retrieve a single candidate string, call setCompletionPrefix() with the text that needs to be completed and call currentCompletion(). You can iterate through the list of completions as below:

for (int i = 0; completer->setCurrentRow(i); i++)

qDebug() << completer->currentCompletion() << " is match number " << i;

completionCount() returns the total number of completions for the current prefix. completionCount() should be avoided when possible, since it requires a scan of the entire model.

The Completion Model

completionModel() return a list model that contains all possible completions for the current completion prefix, in the order in which they appear in the model. This model can be used to display the current completions in a custom view. Calling setCompletionPrefix() automatically refreshes the completion model.

Handling Tree Models

QCompleter can look for completions in tree models, assuming that any item (or sub-item or sub-sub-item) can be unambiguously represented as a string by specifying the path to the item. The completion is then performed one level at a time.

Let's take the example of a user typing in a file system path. The model is a (hierarchical) QFileSystemModel. The completion occurs for every element in the path. For example, if the current text is C:\Wind, QCompleter might suggest Windows to complete the current path element. Similarly, if the current text is C:\Windows\Sy, QCompleter might suggest System.

For this kind of completion to work, QCompleter needs to be able to split the path into a list of strings that are matched at each level. For C:\Windows\Sy, it needs to be split as "C:", "Windows" and "Sy". The default implementation of splitPath(), splits the completionPrefix using QDir::separator() if the model is a QFileSystemModel.

To provide completions, QCompleter needs to know the path from an index. This is provided by pathFromIndex(). The default implementation of pathFromIndex(), returns the data for the edit role for list models and the absolute file path if the mode is a QFileSystemModel.

See also QAbstractItemModel, QLineEdit, QComboBox, and Completer Example.

Member Enumeration Documentation

This enum specifies how completions are provided to the user.

See also setCompletionMode().

Enumerator:
InlineCompletion 

Completions appear inline (as selected text).

PopupCompletion 

Current completions are displayed in a popup window.

UnfilteredPopupCompletion 

All possible completions are displayed in a popup window with the most likely suggestion indicated as current.

This enum specifies how the items in the model are sorted.

See also setModelSorting().

Enumerator:
CaseInsensitivelySortedModel 

The model is sorted case insensitively.

CaseSensitivelySortedModel 

The model is sorted case sensitively.

UnsortedModel 

The model is unsorted.

Constructor & Destructor Documentation

QtGui.QCompleter.QCompleter ( System.Type  dummy)
protected
QtGui.QCompleter.QCompleter ( QObject  parent = null)

Constructs a completer object with the given parent.

QtGui.QCompleter.QCompleter ( QAbstractItemModel  model,
QObject  parent = null 
)

Constructs a completer object with the given parent that provides completions from the specified model.

QtGui.QCompleter.QCompleter ( System.Collections.Generic.List< string >  completions,
QObject  parent = null 
)

Constructs a QCompleter object with the given parent that uses the specified list as a source of possible completions.

Member Function Documentation

new void QtGui.QCompleter.Complete ( )

For QCompleter::PopupCompletion and QCompletion::UnfilteredPopupCompletion modes, calling this function displays the popup displaying the current completions. By default, if rect is not specified, the popup is displayed on the bottom of the widget(). If rect is specified the popup is displayed on the left edge of the rectangle.

For QCompleter::InlineCompletion mode, the highlighted() signal is fired with the current completion.

new void QtGui.QCompleter.Complete ( QRect  rect)

For QCompleter::PopupCompletion and QCompletion::UnfilteredPopupCompletion modes, calling this function displays the popup displaying the current completions. By default, if rect is not specified, the popup is displayed on the bottom of the widget(). If rect is specified the popup is displayed on the left edge of the rectangle.

For QCompleter::InlineCompletion mode, the highlighted() signal is fired with the current completion.

new int QtGui.QCompleter.CompletionCount ( )

Returns the number of completions for the current prefix. For an unsorted model with a large number of items this can be expensive. Use setCurrentRow() and currentCompletion() to iterate through all the completions.

new QAbstractItemModel QtGui.QCompleter.CompletionModel ( )

Returns the completion model. The completion model is a read-only list model that contains all the possible matches for the current completion prefix. The completion model is auto-updated to reflect the current completions.

Note: The return value of this function is defined to be an QAbstractItemModel purely for generality. This actual kind of model returned is an instance of an QAbstractProxyModel subclass.

See also completionPrefix and model().

override void QtGui.QCompleter.CreateProxy ( )
virtual

Reimplemented from QtCore.QObject.

new string QtGui.QCompleter.CurrentCompletion ( )

Returns the current completion string. This includes the completionPrefix. When used alongside setCurrentRow(), it can be used to iterate through all the matches.

See also setCurrentRow() and currentIndex().

new QModelIndex QtGui.QCompleter.CurrentIndex ( )

Returns the model index of the current completion in the completionModel().

See also setCurrentRow(), currentCompletion(), and model().

new int QtGui.QCompleter.CurrentRow ( )

Returns the current row.

See also setCurrentRow().

new void QtGui.QCompleter.Dispose ( )
override bool QtGui.QCompleter.EventFilter ( QObject  o,
QEvent  e 
)
virtual

Reimplemented from QObject::eventFilter().

Reimplemented from QtCore.QObject.

new void QtGui.QCompleter.OnActivated ( QModelIndex  index)
protected

This signal is sent when an item in the popup() is activated by the user. (by clicking or pressing return). The item's index in the completionModel() is given.

new void QtGui.QCompleter.OnActivated ( string  text)
protected

This signal is sent when an item in the popup() is activated by the user (by clicking or pressing return). The item's text is given.

override bool QtGui.QCompleter.OnEvent ( QEvent  arg1)
virtual

Reimplemented from QObject::event().

Reimplemented from QtCore.QObject.

new void QtGui.QCompleter.OnHighlighted ( QModelIndex  index)
protected

This signal is sent when an item in the popup() is highlighted by the user. It is also sent if complete() is called with the completionMode() set to QCompleter::InlineCompletion. The item's index in the completionModel() is given.

new void QtGui.QCompleter.OnHighlighted ( string  text)
protected

This signal is sent when an item in the popup() is highlighted by the user. It is also sent if complete() is called with the completionMode() set to QCompleter::InlineCompletion. The item's text is given.

virtual string QtGui.QCompleter.PathFromIndex ( QModelIndex  index)
virtual

Returns the path for the given index. The completer object uses this to obtain the completion text from the underlying model.

The default implementation returns the edit role of the item for list models. It returns the absolute file path if the model is a QFileSystemModel.

See also splitPath().

new bool QtGui.QCompleter.SetCurrentRow ( int  row)

Sets the current row to the row specified. Returns true if successful; otherwise returns false.

This function may be used along with currentCompletion() to iterate through all the possible completions.

See also currentRow(), currentCompletion(), and completionCount().

virtual System.Collections.Generic.List<string> QtGui.QCompleter.SplitPath ( string  path)
virtual

Splits the given path into strings that are used to match at each level in the model().

The default implementation of splitPath() splits a file system path based on QDir::separator() when the sourceModel() is a QFileSystemModel.

When used with list models, the first item in the returned list is used for matching.

See also pathFromIndex() and Handling Tree Models.

static string QtGui.QCompleter.Tr ( string  s,
string  c = null 
)
static
static string QtGui.QCompleter.Tr ( string  s,
string  c,
int  n 
)
static
static string QtGui.QCompleter.TrUtf8 ( string  s,
string  c = null 
)
static
static string QtGui.QCompleter.TrUtf8 ( string  s,
string  c,
int  n 
)
static

Property Documentation

Slot<System.String> QtGui.QCompleter.Activated
addremove

This signal is sent when an item in the popup() is activated by the user. (by clicking or pressing return). The item's index in the completionModel() is given.

Slot<QModelIndex> QtGui.QCompleter.ActivatedIndex
addremove
new Qt.CaseSensitivity QtGui.QCompleter.CaseSensitivity
getset

This property holds the case sensitivity of the matching.

The default is Qt::CaseSensitive.

new int QtGui.QCompleter.CompletionColumn
getset

This property holds the column in the model in which completions are searched for.

If the popup() is a QListView, it is automatically setup to display this column.

By default, the match column is 0.

new CompletionMode QtGui.QCompleter.completionMode
getset

This property holds how the completions are provided to the user.

The default value is QCompleter::PopupCompletion.

new string QtGui.QCompleter.CompletionPrefix
getset

This property holds the completion prefix used to provide completions.

The completionModel() is updated to reflect the list of possible matches for prefix.

new int QtGui.QCompleter.CompletionRole
getset

This property holds the item role to be used to query the contents of items for matching.

The default role is Qt::EditRole.

new IQCompleterSignals QtGui.QCompleter.Emit
getprotected
Slot<System.String> QtGui.QCompleter.Highlighted
addremove

This signal is sent when an item in the popup() is highlighted by the user. It is also sent if complete() is called with the completionMode() set to QCompleter::InlineCompletion. The item's index in the completionModel() is given.

Slot<QModelIndex> QtGui.QCompleter.HighlightedIndex
addremove
new int QtGui.QCompleter.MaxVisibleItems
getset

This property holds the maximum allowed size on screen of the completer, measured in items.

By default, this property has a value of 7.

This property was introduced in Qt 4.6.

new QAbstractItemModel QtGui.QCompleter.Model
getset

Returns the model that provides completion strings.

Sets the model which provides completions to model. The model can be list model or a tree model. If a model has been already previously set and it has the QCompleter as its parent, it is deleted.

For convenience, if model is a QFileSystemModel, QCompleter switches its caseSensitivity to Qt::CaseInsensitive on Windows and Qt::CaseSensitive on other platforms.

new ModelSorting QtGui.QCompleter.modelSorting
getset

This property holds the way the model is sorted.

By default, no assumptions are made about the order of the items in the model that provides the completions.

If the model's data for the completionColumn() and completionRole() is sorted in ascending order, you can set this property to CaseSensitivelySortedModel or CaseInsensitivelySortedModel. On large models, this can lead to significant performance improvements because the completer object can then use a binary search algorithm instead of linear search algorithm.

The sort order (i.e ascending or descending order) of the model is determined dynamically by inspecting the contents of the model.

Note: The performance improvements described above cannot take place when the completer's caseSensitivity is different to the case sensitivity used by the model's when sorting.

new QAbstractItemView QtGui.QCompleter.Popup
getset

Returns the popup used to display completions.

Sets the popup used to display completions to popup. QCompleter takes ownership of the view.

A QListView is automatically created when the completionMode() is set to QCompleter::PopupCompletion or QCompleter::UnfilteredPopupCompletion. The default popup displays the completionColumn().

Ensure that this function is called before the view settings are modified. This is required since view's properties may require that a model has been set on the view (for example, hiding columns in the view requires a model to be set on the view).

new QMetaObject QtGui.QCompleter.StaticMetaObject
staticget
new QWidget QtGui.QCompleter.Widget
getset

Returns the widget for which the completer object is providing completions.

Sets the widget for which completion are provided for to widget. This function is automatically called when a QCompleter is set on a QLineEdit using QLineEdit::setCompleter() or on a QComboBox using QComboBox::setCompleter(). The widget needs to be set explicitly when providing completions for custom widgets.

new bool QtGui.QCompleter.WrapAround
getset

This property holds the completions wrap around when navigating through items.

The default is true.

This property was introduced in Qt 4.3.