QVirtualKeyboardSelectionListModel Class

List model for selection lists. More...

Header: #include <QVirtualKeyboardSelectionListModel>
Instantiated By: SelectionListModel
Inherits: QAbstractListModel

Public Types

enum class DictionaryType { Default, User }
enum class Role { Display, DisplayRole, WordCompletionLength, WordCompletionLengthRole, Dictionary, CanRemoveSuggestion }
enum class Type { WordCandidateList }

Properties

Public Functions

virtual ~QVirtualKeyboardSelectionListModel()
int count() const
QVariant dataAt(int index, Role role = Role::Display) const
QVirtualKeyboardAbstractInputMethod *dataSource() const
void removeItem(int index)
void selectItem(int index)
void setDataSource(QVirtualKeyboardAbstractInputMethod *dataSource, Type type)

Reimplemented Public Functions

virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
virtual QHash<int, QByteArray> roleNames() const override
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override

Signals

void activeItemChanged(int index)
void countChanged()
void itemSelected(int index)

Protected Slots

void dataSourceDestroyed()
void selectionListActiveItemChanged(Type type, int index)
void selectionListChanged(Type type)

Detailed Description

\inmoduleQtVirtualKeyboard \ingroup qtvirtualkeyboard-cpp-for-devs

This class acts as a bridge between the UI and the input method that provides the data for selection lists.

Member Type Documentation

enum class QVirtualKeyboardSelectionListModel::DictionaryType

This enum specifies the dictionary type of a word.

ConstantValueDescription
QVirtualKeyboardSelectionListModel::DictionaryType::Default0The word candidate is from the default dictionary.
QVirtualKeyboardSelectionListModel::DictionaryType::User1The word candidate is from the user dictionary.

enum class QVirtualKeyboardSelectionListModel::Role

This enum specifies a role of the data requested.

ConstantValueDescription
QVirtualKeyboardSelectionListModel::Role::DisplayQt::DisplayRoleThe data to be rendered in form of text.
QVirtualKeyboardSelectionListModel::Role::DisplayRoleDisplayobsolete Use Role::Display.
QVirtualKeyboardSelectionListModel::Role::WordCompletionLengthQt::UserRole + 1An integer specifying the length of the word the completion part expressed as the number of characters counted from the end of the string.
QVirtualKeyboardSelectionListModel::Role::WordCompletionLengthRoleWordCompletionLengthobsolete Use Role::WordCompletionLength.
QVirtualKeyboardSelectionListModel::Role::Dictionary258An integer specifying l {QVirtualKeyboardSelectionListModel::DictionaryType}{dictionary type}.
QVirtualKeyboardSelectionListModel::Role::CanRemoveSuggestion259A boolean value indicating if the word candidate can be removed from the dictionary.

enum class QVirtualKeyboardSelectionListModel::Type

This enum specifies the type of selection list.

ConstantValueDescription
QVirtualKeyboardSelectionListModel::Type::WordCandidateList0Shows list of word candidates.

Property Documentation

[read-only] count : const int

\internal

Access functions:

int count() const

Notifier signal:

void countChanged()

Member Function Documentation

[virtual noexcept] QVirtualKeyboardSelectionListModel::~QVirtualKeyboardSelectionListModel()

\internal

[signal] void QVirtualKeyboardSelectionListModel::activeItemChanged(int index)

This signal is emitted when the active item in the list changes. The UI should react to this signal by highlighting the item at index in the list.

[override virtual] QVariant QVirtualKeyboardSelectionListModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const

Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.

\internal

[invokable] QVariant QVirtualKeyboardSelectionListModel::dataAt(int index, Role role = Role::Display) const

\internal

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

QVirtualKeyboardAbstractInputMethod *QVirtualKeyboardSelectionListModel::dataSource() const

\internal

See also setDataSource().

[protected slot] void QVirtualKeyboardSelectionListModel::dataSourceDestroyed()

\internal

[signal] void QVirtualKeyboardSelectionListModel::itemSelected(int index)

This signal is emitted when an item at index is selected by the user.

[invokable] void QVirtualKeyboardSelectionListModel::removeItem(int index)

This method should be called when the user removes an item at position index from the list. The removal is forwarded to the input method for further processing.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[override virtual] QHash<int, QByteArray> QVirtualKeyboardSelectionListModel::roleNames() const

Reimplements: QAbstractItemModel::roleNames() const.

\internal

[override virtual] int QVirtualKeyboardSelectionListModel::rowCount(const QModelIndex &parent = QModelIndex()) const

Reimplements: QAbstractItemModel::rowCount(const QModelIndex &parent) const.

\internal

[invokable] void QVirtualKeyboardSelectionListModel::selectItem(int index)

This method should be called when the user selects an item at position index from the list. The selection is forwarded to the input method for further processing.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[protected slot] void QVirtualKeyboardSelectionListModel::selectionListActiveItemChanged(Type type, int index)

\internal

[protected slot] void QVirtualKeyboardSelectionListModel::selectionListChanged(Type type)

\internal

void QVirtualKeyboardSelectionListModel::setDataSource(QVirtualKeyboardAbstractInputMethod *dataSource, Type type)

\internal

See also dataSource().