ModelQuery QML Type

Set of methods for querying QAbstractItemModel-based models. More...

Import Statement: import QtModelsToolkit .

Methods

Detailed Description

Method Documentation

int contains(var model, string roleName, var value, int mode)

Checks if model contains given value for a roleName.

mode can be Qt.CaseSensitive or Qt.CaseInsensitive.


object get(var model, string roleName)

Returns value for given row and roleName from a model.


object get(var model, string roleName)

Returns values (map role name -> value) for given row from a model.


int indexOf(var model, int row)

Returns QPersistentModelIndex for a given row.


int indexOf(var model, string roleName, var value)

Returns the index of given value of given value in the model using QAbstractItemModel::match method with Qt::MatchExactly flag.

Note: QAbstractItemModel::match with Qt::MatchExactly flag performs QVariant-based matching internally. It means that types are not compared and e.g. 4 (int) compared to string "4" will give a positive result.


bool isModel(var obj)

Return true if obj is a model based on QAbstractItemModel.


int roleByName(var model, string roleName)

Returns value of the role for given model and roleName.


list<string> roleNames(var model)

Return role names a string list for given model.