#[repr(C)]
pub struct QStringListModel { /* private fields */ }
Expand description

The QStringListModel class provides a model that supplies strings to views.

C++ class: QStringListModel.

C++ documentation:

The QStringListModel class provides a model that supplies strings to views.

QStringListModel is an editable model that can be used for simple cases where you need to display a number of strings in a view widget, such as a QListView or a QComboBox.

The model provides all the standard functions of an editable model, representing the data in the string list as a model with one column and a number of rows equal to the number of items in the list.

Model indexes corresponding to items are obtained with the index() function, and item flags are obtained with flags(). Item data is read with the data() function and written with setData(). The number of rows (and number of items in the string list) can be found with the rowCount() function.

The model can be constructed with an existing string list, or strings can be set later with the setStringList() convenience function. Strings can also be inserted in the usual way with the insertRows() function, and removed with removeRows(). The contents of the string list can be retrieved with the stringList() convenience function.

An example usage of QStringListModel:

QStringListModel *model = new QStringListModel(); QStringList list; list << “a” << “b” << “c”; model->setStringList(list);

Implementations§

source§

impl QStringListModel

source

pub unsafe fn data_2a( &self, index: impl CastInto<Ref<QModelIndex>>, role: c_int ) -> CppBox<QVariant>

Reimplemented from QAbstractItemModel::data().

Calls C++ function: virtual QVariant QStringListModel::data(const QModelIndex& index, int role = …) const.

C++ documentation:

Reimplemented from QAbstractItemModel::data().

Returns data for the specified role, from the item with the given index.

If the view requests an invalid index, an invalid variant is returned.

See also setData().

source

pub unsafe fn data_1a( &self, index: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QVariant>

Reimplemented from QAbstractItemModel::data().

Calls C++ function: virtual QVariant QStringListModel::data(const QModelIndex& index) const.

C++ documentation:

Reimplemented from QAbstractItemModel::data().

Returns data for the specified role, from the item with the given index.

If the view requests an invalid index, an invalid variant is returned.

See also setData().

source

pub unsafe fn flags( &self, index: impl CastInto<Ref<QModelIndex>> ) -> QFlags<ItemFlag>

Reimplemented from QAbstractItemModel::flags().

Calls C++ function: virtual QFlags<Qt::ItemFlag> QStringListModel::flags(const QModelIndex& index) const.

C++ documentation:

Reimplemented from QAbstractItemModel::flags().

Returns the flags for the item with the given index.

Valid items are enabled, selectable, editable, drag enabled and drop enabled.

See also QAbstractItemModel::flags().

source

pub unsafe fn insert_rows_3a( &self, row: c_int, count: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Reimplemented from QAbstractItemModel::insertRows().

Calls C++ function: virtual bool QStringListModel::insertRows(int row, int count, const QModelIndex& parent = …).

C++ documentation:

Reimplemented from QAbstractItemModel::insertRows().

Inserts count rows into the model, beginning at the given row.

The parent index of the rows is optional and is only used for consistency with QAbstractItemModel. By default, a null index is specified, indicating that the rows are inserted in the top level of the model.

See also QAbstractItemModel::insertRows().

source

pub unsafe fn insert_rows_2a(&self, row: c_int, count: c_int) -> bool

Reimplemented from QAbstractItemModel::insertRows().

Calls C++ function: virtual bool QStringListModel::insertRows(int row, int count).

C++ documentation:

Reimplemented from QAbstractItemModel::insertRows().

Inserts count rows into the model, beginning at the given row.

The parent index of the rows is optional and is only used for consistency with QAbstractItemModel. By default, a null index is specified, indicating that the rows are inserted in the top level of the model.

See also QAbstractItemModel::insertRows().

source

pub unsafe fn item_data( &self, index: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QMapOfIntQVariant>

Reimplements: QAbstractItemModel::itemData(const QModelIndex &index) const.

Calls C++ function: virtual QMap<int, QVariant> QStringListModel::itemData(const QModelIndex& index) const.

C++ documentation:

Reimplements: QAbstractItemModel::itemData(const QModelIndex &index) const.

This function was introduced in Qt 5.13.

See also setItemData().

source

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>

Calls C++ function: virtual const QMetaObject* QStringListModel::metaObject() const.

source

pub unsafe fn move_rows( &self, source_parent: impl CastInto<Ref<QModelIndex>>, source_row: c_int, count: c_int, destination_parent: impl CastInto<Ref<QModelIndex>>, destination_child: c_int ) -> bool

Reimplements: QAbstractItemModel::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild).

Calls C++ function: virtual bool QStringListModel::moveRows(const QModelIndex& sourceParent, int sourceRow, int count, const QModelIndex& destinationParent, int destinationChild).

C++ documentation:

Reimplements: QAbstractItemModel::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild).

This function was introduced in Qt 5.13.

source

pub unsafe fn from_q_object( parent: impl CastInto<Ptr<QObject>> ) -> QBox<QStringListModel>

Constructs a string list model with the given parent.

Calls C++ function: [constructor] void QStringListModel::QStringListModel(QObject* parent = …).

C++ documentation:

Constructs a string list model with the given parent.

source

pub unsafe fn from_q_string_list_q_object( strings: impl CastInto<Ref<QStringList>>, parent: impl CastInto<Ptr<QObject>> ) -> QBox<QStringListModel>

Constructs a string list model containing the specified strings with the given parent.

Calls C++ function: [constructor] void QStringListModel::QStringListModel(const QStringList& strings, QObject* parent = …).

C++ documentation:

Constructs a string list model containing the specified strings with the given parent.

source

pub unsafe fn new() -> QBox<QStringListModel>

The QStringListModel class provides a model that supplies strings to views.

Calls C++ function: [constructor] void QStringListModel::QStringListModel().

C++ documentation:

The QStringListModel class provides a model that supplies strings to views.

QStringListModel is an editable model that can be used for simple cases where you need to display a number of strings in a view widget, such as a QListView or a QComboBox.

The model provides all the standard functions of an editable model, representing the data in the string list as a model with one column and a number of rows equal to the number of items in the list.

Model indexes corresponding to items are obtained with the index() function, and item flags are obtained with flags(). Item data is read with the data() function and written with setData(). The number of rows (and number of items in the string list) can be found with the rowCount() function.

The model can be constructed with an existing string list, or strings can be set later with the setStringList() convenience function. Strings can also be inserted in the usual way with the insertRows() function, and removed with removeRows(). The contents of the string list can be retrieved with the stringList() convenience function.

An example usage of QStringListModel:

QStringListModel *model = new QStringListModel(); QStringList list; list << “a” << “b” << “c”; model->setStringList(list);

source

pub unsafe fn from_q_string_list( strings: impl CastInto<Ref<QStringList>> ) -> QBox<QStringListModel>

Constructs a string list model containing the specified strings with the given parent.

Calls C++ function: [constructor] void QStringListModel::QStringListModel(const QStringList& strings).

C++ documentation:

Constructs a string list model containing the specified strings with the given parent.

source

pub unsafe fn qt_metacall( &self, arg1: Call, arg2: c_int, arg3: *mut *mut c_void ) -> c_int

Calls C++ function: virtual int QStringListModel::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

source

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void

Calls C++ function: virtual void* QStringListModel::qt_metacast(const char* arg1).

source

pub unsafe fn remove_rows_3a( &self, row: c_int, count: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Reimplemented from QAbstractItemModel::removeRows().

Calls C++ function: virtual bool QStringListModel::removeRows(int row, int count, const QModelIndex& parent = …).

C++ documentation:

Reimplemented from QAbstractItemModel::removeRows().

Removes count rows from the model, beginning at the given row.

The parent index of the rows is optional and is only used for consistency with QAbstractItemModel. By default, a null index is specified, indicating that the rows are removed in the top level of the model.

See also QAbstractItemModel::removeRows().

source

pub unsafe fn remove_rows_2a(&self, row: c_int, count: c_int) -> bool

Reimplemented from QAbstractItemModel::removeRows().

Calls C++ function: virtual bool QStringListModel::removeRows(int row, int count).

C++ documentation:

Reimplemented from QAbstractItemModel::removeRows().

Removes count rows from the model, beginning at the given row.

The parent index of the rows is optional and is only used for consistency with QAbstractItemModel. By default, a null index is specified, indicating that the rows are removed in the top level of the model.

See also QAbstractItemModel::removeRows().

source

pub unsafe fn row_count_1a( &self, parent: impl CastInto<Ref<QModelIndex>> ) -> c_int

Reimplemented from QAbstractItemModel::rowCount().

Calls C++ function: virtual int QStringListModel::rowCount(const QModelIndex& parent = …) const.

C++ documentation:

Reimplemented from QAbstractItemModel::rowCount().

Returns the number of rows in the model. This value corresponds to the number of items in the model's internal string list.

The optional parent argument is in most models used to specify the parent of the rows to be counted. Because this is a list if a valid parent is specified, the result will always be 0.

See also insertRows(), removeRows(), and QAbstractItemModel::rowCount().

source

pub unsafe fn row_count_0a(&self) -> c_int

Reimplemented from QAbstractItemModel::rowCount().

Calls C++ function: virtual int QStringListModel::rowCount() const.

C++ documentation:

Reimplemented from QAbstractItemModel::rowCount().

Returns the number of rows in the model. This value corresponds to the number of items in the model's internal string list.

The optional parent argument is in most models used to specify the parent of the rows to be counted. Because this is a list if a valid parent is specified, the result will always be 0.

See also insertRows(), removeRows(), and QAbstractItemModel::rowCount().

source

pub unsafe fn set_data_3a( &self, index: impl CastInto<Ref<QModelIndex>>, value: impl CastInto<Ref<QVariant>>, role: c_int ) -> bool

Reimplemented from QAbstractItemModel::setData().

Calls C++ function: virtual bool QStringListModel::setData(const QModelIndex& index, const QVariant& value, int role = …).

C++ documentation:

Reimplemented from QAbstractItemModel::setData().

Sets the data for the specified role in the item with the given index in the model, to the provided value.

The dataChanged() signal is emitted if the item is changed.

See also Qt::ItemDataRole and data().

source

pub unsafe fn set_data_2a( &self, index: impl CastInto<Ref<QModelIndex>>, value: impl CastInto<Ref<QVariant>> ) -> bool

Reimplemented from QAbstractItemModel::setData().

Calls C++ function: virtual bool QStringListModel::setData(const QModelIndex& index, const QVariant& value).

C++ documentation:

Reimplemented from QAbstractItemModel::setData().

Sets the data for the specified role in the item with the given index in the model, to the provided value.

The dataChanged() signal is emitted if the item is changed.

See also Qt::ItemDataRole and data().

source

pub unsafe fn set_item_data( &self, index: impl CastInto<Ref<QModelIndex>>, roles: impl CastInto<Ref<QMapOfIntQVariant>> ) -> bool

Reimplements: QAbstractItemModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles).

Calls C++ function: virtual bool QStringListModel::setItemData(const QModelIndex& index, const QMap<int, QVariant>& roles).

C++ documentation:

Reimplements: QAbstractItemModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles).

If roles contains both Qt::DisplayRole and Qt::EditRole, the latter will take precedence

This function was introduced in Qt 5.13.

See also itemData().

source

pub unsafe fn set_string_list(&self, strings: impl CastInto<Ref<QStringList>>)

Sets the model's internal string list to strings. The model will notify any attached views that its underlying data has changed.

Calls C++ function: void QStringListModel::setStringList(const QStringList& strings).

C++ documentation:

Sets the model’s internal string list to strings. The model will notify any attached views that its underlying data has changed.

See also stringList() and dataChanged().

source

pub unsafe fn sibling( &self, row: c_int, column: c_int, idx: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QModelIndex>

Reimplemented from QAbstractItemModel::sibling().

Calls C++ function: virtual QModelIndex QStringListModel::sibling(int row, int column, const QModelIndex& idx) const.

C++ documentation:

Reimplemented from QAbstractItemModel::sibling().

source

pub unsafe fn sort_2a(&self, column: c_int, order: SortOrder)

Reimplemented from QAbstractItemModel::sort().

Calls C++ function: virtual void QStringListModel::sort(int column, Qt::SortOrder order = …).

C++ documentation:

Reimplemented from QAbstractItemModel::sort().

source

pub unsafe fn sort_1a(&self, column: c_int)

Reimplemented from QAbstractItemModel::sort().

Calls C++ function: virtual void QStringListModel::sort(int column).

C++ documentation:

Reimplemented from QAbstractItemModel::sort().

source

pub unsafe fn static_meta_object() -> Ref<QMetaObject>

Returns a reference to the staticMetaObject field.

source

pub unsafe fn string_list(&self) -> CppBox<QStringList>

Returns the string list used by the model to store data.

Calls C++ function: QStringList QStringListModel::stringList() const.

C++ documentation:

Returns the string list used by the model to store data.

See also setStringList().

source

pub unsafe fn supported_drop_actions(&self) -> QFlags<DropAction>

Reimplemented from QAbstractItemModel::supportedDropActions().

Calls C++ function: virtual QFlags<Qt::DropAction> QStringListModel::supportedDropActions() const.

C++ documentation:

source

pub unsafe fn tr( s: *const c_char, c: *const c_char, n: c_int ) -> CppBox<QString>

Calls C++ function: static QString QStringListModel::tr(const char* s, const char* c, int n).

source

pub unsafe fn tr_utf8( s: *const c_char, c: *const c_char, n: c_int ) -> CppBox<QString>

Calls C++ function: static QString QStringListModel::trUtf8(const char* s, const char* c, int n).

Methods from Deref<Target = QAbstractListModel>§

source

pub unsafe fn drop_mime_data( &self, data: impl CastInto<Ptr<QMimeData>>, action: DropAction, row: c_int, column: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Reimplemented from QAbstractItemModel::dropMimeData().

Calls C++ function: virtual bool QAbstractListModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent).

C++ documentation:

Reimplemented from QAbstractItemModel::dropMimeData().

source

pub unsafe fn flags( &self, index: impl CastInto<Ref<QModelIndex>> ) -> QFlags<ItemFlag>

Reimplemented from QAbstractItemModel::flags().

Calls C++ function: virtual QFlags<Qt::ItemFlag> QAbstractListModel::flags(const QModelIndex& index) const.

C++ documentation:

Reimplemented from QAbstractItemModel::flags().

source

pub unsafe fn index_3a( &self, row: c_int, column: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QModelIndex>

Reimplemented from QAbstractItemModel::index().

Calls C++ function: virtual QModelIndex QAbstractListModel::index(int row, int column = …, const QModelIndex& parent = …) const.

C++ documentation:

Reimplemented from QAbstractItemModel::index().

Returns the index of the data in row and column with parent.

See also parent().

source

pub unsafe fn index_2a(&self, row: c_int, column: c_int) -> CppBox<QModelIndex>

Reimplemented from QAbstractItemModel::index().

Calls C++ function: virtual QModelIndex QAbstractListModel::index(int row, int column = …) const.

C++ documentation:

Reimplemented from QAbstractItemModel::index().

Returns the index of the data in row and column with parent.

See also parent().

source

pub unsafe fn index_1a(&self, row: c_int) -> CppBox<QModelIndex>

Reimplemented from QAbstractItemModel::index().

Calls C++ function: virtual QModelIndex QAbstractListModel::index(int row) const.

C++ documentation:

Reimplemented from QAbstractItemModel::index().

Returns the index of the data in row and column with parent.

See also parent().

source

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>

Calls C++ function: virtual const QMetaObject* QAbstractListModel::metaObject() const.

source

pub unsafe fn qt_metacall( &self, arg1: Call, arg2: c_int, arg3: *mut *mut c_void ) -> c_int

Calls C++ function: virtual int QAbstractListModel::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

source

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void

Calls C++ function: virtual void* QAbstractListModel::qt_metacast(const char* arg1).

source

pub unsafe fn sibling( &self, row: c_int, column: c_int, idx: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QModelIndex>

Reimplemented from QAbstractItemModel::sibling().

Calls C++ function: virtual QModelIndex QAbstractListModel::sibling(int row, int column, const QModelIndex& idx) const.

C++ documentation:

Reimplemented from QAbstractItemModel::sibling().

Methods from Deref<Target = QAbstractItemModel>§

source

pub fn header_data_changed(&self) -> Signal<(Orientation, c_int, c_int)>

This signal is emitted whenever a header is changed. The orientation indicates whether the horizontal or vertical header has changed. The sections in the header from the first to the last need to be updated.

Returns a built-in Qt signal QAbstractItemModel::headerDataChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted whenever a header is changed. The orientation indicates whether the horizontal or vertical header has changed. The sections in the header from the first to the last need to be updated.

When reimplementing the setHeaderData() function, this signal must be emitted explicitly.

If you are changing the number of columns or rows you do not need to emit this signal, but use the begin/end functions (refer to the section on subclassing in the QAbstractItemModel class description for details).

See also headerData(), setHeaderData(), and dataChanged().

source

pub fn rows_about_to_be_inserted( &self ) -> Signal<(*const QModelIndex, c_int, c_int)>

This signal is emitted just before rows are inserted into the model. The new items will be positioned between start and end inclusive, under the given parent item.

Returns a built-in Qt signal QAbstractItemModel::rowsAboutToBeInserted that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted just before rows are inserted into the model. The new items will be positioned between start and end inclusive, under the given parent item.

Note: Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also insertRows() and beginInsertRows().

source

pub fn rows_inserted(&self) -> Signal<(*const QModelIndex, c_int, c_int)>

This signal is emitted after rows have been inserted into the model. The new items are those between first and last inclusive, under the given parent item.

Returns a built-in Qt signal QAbstractItemModel::rowsInserted that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted after rows have been inserted into the model. The new items are those between first and last inclusive, under the given parent item.

Note: Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also insertRows() and beginInsertRows().

source

pub fn rows_about_to_be_removed( &self ) -> Signal<(*const QModelIndex, c_int, c_int)>

This signal is emitted just before rows are removed from the model. The items that will be removed are those between first and last inclusive, under the given parent item.

Returns a built-in Qt signal QAbstractItemModel::rowsAboutToBeRemoved that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted just before rows are removed from the model. The items that will be removed are those between first and last inclusive, under the given parent item.

Note: Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also removeRows() and beginRemoveRows().

source

pub fn rows_removed(&self) -> Signal<(*const QModelIndex, c_int, c_int)>

This signal is emitted after rows have been removed from the model. The removed items are those between first and last inclusive, under the given parent item.

Returns a built-in Qt signal QAbstractItemModel::rowsRemoved that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted after rows have been removed from the model. The removed items are those between first and last inclusive, under the given parent item.

Note: Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also removeRows() and beginRemoveRows().

source

pub fn columns_about_to_be_inserted( &self ) -> Signal<(*const QModelIndex, c_int, c_int)>

This signal is emitted just before columns are inserted into the model. The new items will be positioned between first and last inclusive, under the given parent item.

Returns a built-in Qt signal QAbstractItemModel::columnsAboutToBeInserted that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted just before columns are inserted into the model. The new items will be positioned between first and last inclusive, under the given parent item.

Note: Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also insertColumns() and beginInsertColumns().

source

pub fn columns_inserted(&self) -> Signal<(*const QModelIndex, c_int, c_int)>

This signal is emitted after columns have been inserted into the model. The new items are those between first and last inclusive, under the given parent item.

Returns a built-in Qt signal QAbstractItemModel::columnsInserted that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted after columns have been inserted into the model. The new items are those between first and last inclusive, under the given parent item.

Note: Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also insertColumns() and beginInsertColumns().

source

pub fn columns_about_to_be_removed( &self ) -> Signal<(*const QModelIndex, c_int, c_int)>

This signal is emitted just before columns are removed from the model. The items to be removed are those between first and last inclusive, under the given parent item.

Returns a built-in Qt signal QAbstractItemModel::columnsAboutToBeRemoved that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted just before columns are removed from the model. The items to be removed are those between first and last inclusive, under the given parent item.

Note: Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also removeColumns() and beginRemoveColumns().

source

pub fn columns_removed(&self) -> Signal<(*const QModelIndex, c_int, c_int)>

This signal is emitted after columns have been removed from the model. The removed items are those between first and last inclusive, under the given parent item.

Returns a built-in Qt signal QAbstractItemModel::columnsRemoved that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted after columns have been removed from the model. The removed items are those between first and last inclusive, under the given parent item.

Note: Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also removeColumns() and beginRemoveColumns().

source

pub fn model_about_to_be_reset(&self) -> Signal<()>

This signal is emitted when beginResetModel() is called, before the model's internal state (e.g. persistent model indexes) has been invalidated.

Returns a built-in Qt signal QAbstractItemModel::modelAboutToBeReset that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when beginResetModel() is called, before the model’s internal state (e.g. persistent model indexes) has been invalidated.

This function was introduced in Qt 4.2.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also beginResetModel() and modelReset().

source

pub fn model_reset(&self) -> Signal<()>

This signal is emitted when endResetModel() is called, after the model's internal state (e.g. persistent model indexes) has been invalidated.

Returns a built-in Qt signal QAbstractItemModel::modelReset that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when endResetModel() is called, after the model’s internal state (e.g. persistent model indexes) has been invalidated.

Note that if a model is reset it should be considered that all information previously retrieved from it is invalid. This includes but is not limited to the rowCount() and columnCount(), flags(), data retrieved through data(), and roleNames().

This function was introduced in Qt 4.1.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also endResetModel() and modelAboutToBeReset().

source

pub fn rows_about_to_be_moved( &self ) -> Signal<(*const QModelIndex, c_int, c_int, *const QModelIndex, c_int)>

This signal is emitted just before rows are moved within the model. The items that will be moved are those between sourceStart and sourceEnd inclusive, under the given sourceParent item. They will be moved to destinationParent starting at the row destinationRow.

Returns a built-in Qt signal QAbstractItemModel::rowsAboutToBeMoved that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted just before rows are moved within the model. The items that will be moved are those between sourceStart and sourceEnd inclusive, under the given sourceParent item. They will be moved to destinationParent starting at the row destinationRow.

Note: Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.

This function was introduced in Qt 4.6.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also beginMoveRows().

source

pub fn rows_moved( &self ) -> Signal<(*const QModelIndex, c_int, c_int, *const QModelIndex, c_int)>

This signal is emitted after rows have been moved within the model. The items between start and end inclusive, under the given parent item have been moved to destination starting at the row row.

Returns a built-in Qt signal QAbstractItemModel::rowsMoved that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted after rows have been moved within the model. The items between start and end inclusive, under the given parent item have been moved to destination starting at the row row.

Note: Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.

This function was introduced in Qt 4.6.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also beginMoveRows().

source

pub fn columns_about_to_be_moved( &self ) -> Signal<(*const QModelIndex, c_int, c_int, *const QModelIndex, c_int)>

This signal is emitted just before columns are moved within the model. The items that will be moved are those between sourceStart and sourceEnd inclusive, under the given sourceParent item. They will be moved to destinationParent starting at the column destinationColumn.

Returns a built-in Qt signal QAbstractItemModel::columnsAboutToBeMoved that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted just before columns are moved within the model. The items that will be moved are those between sourceStart and sourceEnd inclusive, under the given sourceParent item. They will be moved to destinationParent starting at the column destinationColumn.

Note: Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.

This function was introduced in Qt 4.6.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also beginMoveRows().

source

pub fn columns_moved( &self ) -> Signal<(*const QModelIndex, c_int, c_int, *const QModelIndex, c_int)>

This signal is emitted after columns have been moved within the model. The items between start and end inclusive, under the given parent item have been moved to destination starting at the column column.

Returns a built-in Qt signal QAbstractItemModel::columnsMoved that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted after columns have been moved within the model. The items between start and end inclusive, under the given parent item have been moved to destination starting at the column column.

Note: Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.

This function was introduced in Qt 4.6.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also beginMoveRows().

source

pub fn slot_submit(&self) -> Receiver<()>

Lets the model know that it should submit cached information to permanent storage. This function is typically used for row editing.

Returns a built-in Qt slot QAbstractItemModel::submit that can be passed to qt_core::Signal::connect.

C++ documentation:

Lets the model know that it should submit cached information to permanent storage. This function is typically used for row editing.

Returns true if there is no error; otherwise returns false.

See also revert().

source

pub fn slot_revert(&self) -> Receiver<()>

Lets the model know that it should discard cached information. This function is typically used for row editing.

Returns a built-in Qt slot QAbstractItemModel::revert that can be passed to qt_core::Signal::connect.

C++ documentation:

Lets the model know that it should discard cached information. This function is typically used for row editing.

See also submit().

source

pub fn slot_reset_internal_data(&self) -> Receiver<()>

This slot is called just after the internal data of a model is cleared while it is being reset.

Returns a built-in Qt slot QAbstractItemModel::resetInternalData that can be passed to qt_core::Signal::connect.

C++ documentation:

This slot is called just after the internal data of a model is cleared while it is being reset.

This slot is provided the convenience of subclasses of concrete proxy models, such as subclasses of QSortFilterProxyModel which maintain extra data.

class CustomDataProxy : public QSortFilterProxyModel { Q_OBJECT public: CustomDataProxy(QObject *parent) : QSortFilterProxyModel(parent) { }

...

QVariant data(const QModelIndex &index, int role) { if (role != Qt::BackgroundRole) return QSortFilterProxyModel::data(index, role);

if (m_customData.contains(index.row())) return m_customData.value(index.row()); return QSortFilterProxyModel::data(index, role); }

private slots: void resetInternalData() { m_customData.clear(); }

private: QHash<int, QVariant> m_customData; };

Note: Due to a mistake, this slot is missing in Qt 5.0.

This function was introduced in Qt 4.8.

See also modelAboutToBeReset() and modelReset().

source

pub fn data_changed( &self ) -> Signal<(*const QModelIndex, *const QModelIndex, *const QVectorOfInt)>

This signal is emitted whenever the data in an existing item changes.

Returns a built-in Qt signal QAbstractItemModel::dataChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted whenever the data in an existing item changes.

If the items are of the same parent, the affected ones are those between topLeft and bottomRight inclusive. If the items do not have the same parent, the behavior is undefined.

When reimplementing the setData() function, this signal must be emitted explicitly.

The optional roles argument can be used to specify which data roles have actually been modified. An empty vector in the roles argument means that all roles should be considered modified. The order of elements in the roles argument does not have any relevance.

See also headerDataChanged(), setData(), and layoutChanged().

source

pub fn layout_changed( &self ) -> Signal<(*const QListOfQPersistentModelIndex, LayoutChangeHint)>

This signal is emitted whenever the layout of items exposed by the model has changed; for example, when the model has been sorted. When this signal is received by a view, it should update the layout of items to reflect this change.

Returns a built-in Qt signal QAbstractItemModel::layoutChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted whenever the layout of items exposed by the model has changed; for example, when the model has been sorted. When this signal is received by a view, it should update the layout of items to reflect this change.

When subclassing QAbstractItemModel or QAbstractProxyModel, ensure that you emit layoutAboutToBeChanged() before changing the order of items or altering the structure of the data you expose to views, and emit layoutChanged() after changing the layout.

The optional parents parameter is used to give a more specific notification about what parts of the layout of the model are changing. An empty list indicates a change to the layout of the entire model. The order of elements in the parents list is not significant. The optional hint parameter is used to give a hint about what is happening while the model is relayouting.

Subclasses should update any persistent model indexes before emitting layoutChanged(). In other words, when the structure changes:

This function was introduced in Qt 5.0.

See also layoutAboutToBeChanged(), dataChanged(), headerDataChanged(), modelReset(), and changePersistentIndex().

source

pub fn layout_about_to_be_changed( &self ) -> Signal<(*const QListOfQPersistentModelIndex, LayoutChangeHint)>

This signal is emitted just before the layout of a model is changed. Components connected to this signal use it to adapt to changes in the model's layout.

Returns a built-in Qt signal QAbstractItemModel::layoutAboutToBeChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted just before the layout of a model is changed. Components connected to this signal use it to adapt to changes in the model’s layout.

Subclasses should update any persistent model indexes after emitting layoutAboutToBeChanged().

The optional parents parameter is used to give a more specific notification about what parts of the layout of the model are changing. An empty list indicates a change to the layout of the entire model. The order of elements in the parents list is not significant. The optional hint parameter is used to give a hint about what is happening while the model is relayouting.

This function was introduced in Qt 5.0.

See also layoutChanged() and changePersistentIndex().

source

pub unsafe fn buddy( &self, index: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QModelIndex>

Returns a model index for the buddy of the item represented by index. When the user wants to edit an item, the view will call this function to check whether another item in the model should be edited instead. Then, the view will construct a delegate using the model index returned by the buddy item.

Calls C++ function: virtual QModelIndex QAbstractItemModel::buddy(const QModelIndex& index) const.

C++ documentation:

Returns a model index for the buddy of the item represented by index. When the user wants to edit an item, the view will call this function to check whether another item in the model should be edited instead. Then, the view will construct a delegate using the model index returned by the buddy item.

The default implementation of this function has each item as its own buddy.

source

pub unsafe fn can_drop_mime_data( &self, data: impl CastInto<Ptr<QMimeData>>, action: DropAction, row: c_int, column: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Returns true if a model can accept a drop of the data. This default implementation only checks if data has at least one format in the list of mimeTypes() and if action is among the model's supportedDropActions().

Calls C++ function: virtual bool QAbstractItemModel::canDropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) const.

C++ documentation:

Returns true if a model can accept a drop of the data. This default implementation only checks if data has at least one format in the list of mimeTypes() and if action is among the model’s supportedDropActions().

Reimplement this function in your custom model, if you want to test whether the data can be dropped at row, column, parent with action. If you don't need that test, it is not necessary to reimplement this function.

See also dropMimeData() and Using drag and drop with item views.

source

pub unsafe fn can_fetch_more( &self, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Returns true if there is more data available for parent; otherwise returns false.

Calls C++ function: virtual bool QAbstractItemModel::canFetchMore(const QModelIndex& parent) const.

C++ documentation:

Returns true if there is more data available for parent; otherwise returns false.

The default implementation always returns false.

If canFetchMore() returns true, the fetchMore() function should be called. This is the behavior of QAbstractItemView, for example.

See also fetchMore().

source

pub unsafe fn check_index_2a( &self, index: impl CastInto<Ref<QModelIndex>>, options: QFlags<CheckIndexOption> ) -> bool

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This function checks whether index is a legal model index for this model. A legal model index is either an invalid model index, or a valid model index for which all the following holds:

Calls C++ function: bool QAbstractItemModel::checkIndex(const QModelIndex& index, QFlags<QAbstractItemModel::CheckIndexOption> options = …) const.

C++ documentation:

This function checks whether index is a legal model index for this model. A legal model index is either an invalid model index, or a valid model index for which all the following holds:

  • the index' model is this;
  • the index' row is greater or equal than zero;
  • the index' row is less than the row count for the index' parent;
  • the index' column is greater or equal than zero;
  • the index' column is less than the column count for the index' parent.

The options argument may change some of these checks. If options contains IndexIsValid, then index must be a valid index; this is useful when reimplementing functions such as data() or setData(), which expect valid indexes.

If options contains DoNotUseParent, then the checks that would call parent() are omitted; this allows calling this function from a parent() reimplementation (otherwise, this would result in endless recursion and a crash).

If options does not contain DoNotUseParent, and it contains ParentIsInvalid, then an additional check is performed: the parent index is checked for not being valid. This is useful when implementing flat models such as lists or tables, where no model index should have a valid parent index.

This function returns true if all the checks succeeded, and false otherwise. This allows to use the function in Q_ASSERT and similar other debugging mechanisms. If some check failed, a warning message will be printed in the qt.core.qabstractitemmodel.checkindex logging category, containing some information that may be useful for debugging the failure.

Note: This function is a debugging helper for implementing your own item models. When developing complex models, as well as when building complicated model hierarchies (e.g. using proxy models), it is useful to call this function in order to catch bugs relative to illegal model indices (as defined above) accidentally passed to some QAbstractItemModel API.

Warning: Note that it's undefined behavior to pass illegal indices to item models, so applications must refrain from doing so, and not rely on any "defensive" programming that item models could employ to handle illegal indexes gracefully.

This function was introduced in Qt 5.11.

See also QModelIndex.

source

pub unsafe fn check_index_1a( &self, index: impl CastInto<Ref<QModelIndex>> ) -> bool

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This function checks whether index is a legal model index for this model. A legal model index is either an invalid model index, or a valid model index for which all the following holds:

Calls C++ function: bool QAbstractItemModel::checkIndex(const QModelIndex& index) const.

C++ documentation:

This function checks whether index is a legal model index for this model. A legal model index is either an invalid model index, or a valid model index for which all the following holds:

  • the index' model is this;
  • the index' row is greater or equal than zero;
  • the index' row is less than the row count for the index' parent;
  • the index' column is greater or equal than zero;
  • the index' column is less than the column count for the index' parent.

The options argument may change some of these checks. If options contains IndexIsValid, then index must be a valid index; this is useful when reimplementing functions such as data() or setData(), which expect valid indexes.

If options contains DoNotUseParent, then the checks that would call parent() are omitted; this allows calling this function from a parent() reimplementation (otherwise, this would result in endless recursion and a crash).

If options does not contain DoNotUseParent, and it contains ParentIsInvalid, then an additional check is performed: the parent index is checked for not being valid. This is useful when implementing flat models such as lists or tables, where no model index should have a valid parent index.

This function returns true if all the checks succeeded, and false otherwise. This allows to use the function in Q_ASSERT and similar other debugging mechanisms. If some check failed, a warning message will be printed in the qt.core.qabstractitemmodel.checkindex logging category, containing some information that may be useful for debugging the failure.

Note: This function is a debugging helper for implementing your own item models. When developing complex models, as well as when building complicated model hierarchies (e.g. using proxy models), it is useful to call this function in order to catch bugs relative to illegal model indices (as defined above) accidentally passed to some QAbstractItemModel API.

Warning: Note that it's undefined behavior to pass illegal indices to item models, so applications must refrain from doing so, and not rely on any "defensive" programming that item models could employ to handle illegal indexes gracefully.

This function was introduced in Qt 5.11.

See also QModelIndex.

source

pub unsafe fn column_count_1a( &self, parent: impl CastInto<Ref<QModelIndex>> ) -> c_int

Returns the number of columns for the children of the given parent.

Calls C++ function: pure virtual int QAbstractItemModel::columnCount(const QModelIndex& parent = …) const.

C++ documentation:

Returns the number of columns for the children of the given parent.

In most subclasses, the number of columns is independent of the parent.

For example:

int DomModel::columnCount(const QModelIndex &/parent/) const { return 3; }

Note: When implementing a table based model, columnCount() should return 0 when the parent is valid.

See also rowCount().

source

pub unsafe fn column_count_0a(&self) -> c_int

Returns the number of columns for the children of the given parent.

Calls C++ function: pure virtual int QAbstractItemModel::columnCount() const.

C++ documentation:

Returns the number of columns for the children of the given parent.

In most subclasses, the number of columns is independent of the parent.

For example:

int DomModel::columnCount(const QModelIndex &/parent/) const { return 3; }

Note: When implementing a table based model, columnCount() should return 0 when the parent is valid.

See also rowCount().

source

pub unsafe fn data_2a( &self, index: impl CastInto<Ref<QModelIndex>>, role: c_int ) -> CppBox<QVariant>

Returns the data stored under the given role for the item referred to by the index.

Calls C++ function: pure virtual QVariant QAbstractItemModel::data(const QModelIndex& index, int role = …) const.

C++ documentation:

Returns the data stored under the given role for the item referred to by the index.

Note: If you do not have a value to return, return an invalid QVariant instead of returning 0.

See also Qt::ItemDataRole, setData(), and headerData().

source

pub unsafe fn data_1a( &self, index: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QVariant>

Returns the data stored under the given role for the item referred to by the index.

Calls C++ function: pure virtual QVariant QAbstractItemModel::data(const QModelIndex& index) const.

C++ documentation:

Returns the data stored under the given role for the item referred to by the index.

Note: If you do not have a value to return, return an invalid QVariant instead of returning 0.

See also Qt::ItemDataRole, setData(), and headerData().

source

pub unsafe fn drop_mime_data( &self, data: impl CastInto<Ptr<QMimeData>>, action: DropAction, row: c_int, column: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Handles the data supplied by a drag and drop operation that ended with the given action.

Calls C++ function: virtual bool QAbstractItemModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent).

C++ documentation:

Handles the data supplied by a drag and drop operation that ended with the given action.

Returns true if the data and action were handled by the model; otherwise returns false.

The specified row, column and parent indicate the location of an item in the model where the operation ended. It is the responsibility of the model to complete the action at the correct location.

For instance, a drop action on an item in a QTreeView can result in new items either being inserted as children of the item specified by row, column, and parent, or as siblings of the item.

When row and column are -1 it means that the dropped data should be considered as dropped directly on parent. Usually this will mean appending the data as child items of parent. If row and column are greater than or equal zero, it means that the drop occurred just before the specified row and column in the specified parent.

The mimeTypes() member is called to get the list of acceptable MIME types. This default implementation assumes the default implementation of mimeTypes(), which returns a single default MIME type. If you reimplement mimeTypes() in your custom model to return multiple MIME types, you must reimplement this function to make use of them.

See also supportedDropActions(), canDropMimeData(), and Using drag and drop with item views.

source

pub unsafe fn fetch_more(&self, parent: impl CastInto<Ref<QModelIndex>>)

Fetches any available data for the items with the parent specified by the parent index.

Calls C++ function: virtual void QAbstractItemModel::fetchMore(const QModelIndex& parent).

C++ documentation:

Fetches any available data for the items with the parent specified by the parent index.

Reimplement this if you are populating your model incrementally.

The default implementation does nothing.

See also canFetchMore().

source

pub unsafe fn flags( &self, index: impl CastInto<Ref<QModelIndex>> ) -> QFlags<ItemFlag>

Returns the item flags for the given index.

Calls C++ function: virtual QFlags<Qt::ItemFlag> QAbstractItemModel::flags(const QModelIndex& index) const.

C++ documentation:

Returns the item flags for the given index.

The base class implementation returns a combination of flags that enables the item (ItemIsEnabled) and allows it to be selected (ItemIsSelectable).

See also Qt::ItemFlags.

source

pub unsafe fn has_children_1a( &self, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Returns true if parent has any children; otherwise returns false.

Calls C++ function: virtual bool QAbstractItemModel::hasChildren(const QModelIndex& parent = …) const.

C++ documentation:

Returns true if parent has any children; otherwise returns false.

Use rowCount() on the parent to find out the number of children.

Note that it is undefined behavior to report that a particular index hasChildren with this method if the same index has the flag Qt::ItemNeverHasChildren set.

See also parent() and index().

source

pub unsafe fn has_children_0a(&self) -> bool

Returns true if parent has any children; otherwise returns false.

Calls C++ function: virtual bool QAbstractItemModel::hasChildren() const.

C++ documentation:

Returns true if parent has any children; otherwise returns false.

Use rowCount() on the parent to find out the number of children.

Note that it is undefined behavior to report that a particular index hasChildren with this method if the same index has the flag Qt::ItemNeverHasChildren set.

See also parent() and index().

source

pub unsafe fn has_index_3a( &self, row: c_int, column: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Returns true if the model returns a valid QModelIndex for row and column with parent, otherwise returns false.

Calls C++ function: bool QAbstractItemModel::hasIndex(int row, int column, const QModelIndex& parent = …) const.

C++ documentation:

Returns true if the model returns a valid QModelIndex for row and column with parent, otherwise returns false.

source

pub unsafe fn has_index_2a(&self, row: c_int, column: c_int) -> bool

Returns true if the model returns a valid QModelIndex for row and column with parent, otherwise returns false.

Calls C++ function: bool QAbstractItemModel::hasIndex(int row, int column) const.

C++ documentation:

Returns true if the model returns a valid QModelIndex for row and column with parent, otherwise returns false.

source

pub unsafe fn header_data_3a( &self, section: c_int, orientation: Orientation, role: c_int ) -> CppBox<QVariant>

Returns the data for the given role and section in the header with the specified orientation.

Calls C++ function: virtual QVariant QAbstractItemModel::headerData(int section, Qt::Orientation orientation, int role = …) const.

C++ documentation:

Returns the data for the given role and section in the header with the specified orientation.

For horizontal headers, the section number corresponds to the column number. Similarly, for vertical headers, the section number corresponds to the row number.

See also Qt::ItemDataRole, setHeaderData(), and QHeaderView.

source

pub unsafe fn header_data_2a( &self, section: c_int, orientation: Orientation ) -> CppBox<QVariant>

Returns the data for the given role and section in the header with the specified orientation.

Calls C++ function: virtual QVariant QAbstractItemModel::headerData(int section, Qt::Orientation orientation) const.

C++ documentation:

Returns the data for the given role and section in the header with the specified orientation.

For horizontal headers, the section number corresponds to the column number. Similarly, for vertical headers, the section number corresponds to the row number.

See also Qt::ItemDataRole, setHeaderData(), and QHeaderView.

source

pub unsafe fn index_3a( &self, row: c_int, column: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QModelIndex>

Returns the index of the item in the model specified by the given row, column and parent index.

Calls C++ function: pure virtual QModelIndex QAbstractItemModel::index(int row, int column, const QModelIndex& parent = …) const.

C++ documentation:

Returns the index of the item in the model specified by the given row, column and parent index.

When reimplementing this function in a subclass, call createIndex() to generate model indexes that other components can use to refer to items in your model.

See also createIndex().

source

pub unsafe fn index_2a(&self, row: c_int, column: c_int) -> CppBox<QModelIndex>

Returns the index of the item in the model specified by the given row, column and parent index.

Calls C++ function: pure virtual QModelIndex QAbstractItemModel::index(int row, int column) const.

C++ documentation:

Returns the index of the item in the model specified by the given row, column and parent index.

When reimplementing this function in a subclass, call createIndex() to generate model indexes that other components can use to refer to items in your model.

See also createIndex().

source

pub unsafe fn insert_column_2a( &self, column: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Inserts a single column before the given column in the child items of the parent specified.

Calls C++ function: bool QAbstractItemModel::insertColumn(int column, const QModelIndex& parent = …).

C++ documentation:

Inserts a single column before the given column in the child items of the parent specified.

Returns true if the column is inserted; otherwise returns false.

See also insertColumns(), insertRow(), and removeColumn().

source

pub unsafe fn insert_column_1a(&self, column: c_int) -> bool

Inserts a single column before the given column in the child items of the parent specified.

Calls C++ function: bool QAbstractItemModel::insertColumn(int column).

C++ documentation:

Inserts a single column before the given column in the child items of the parent specified.

Returns true if the column is inserted; otherwise returns false.

See also insertColumns(), insertRow(), and removeColumn().

source

pub unsafe fn insert_columns_3a( &self, column: c_int, count: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

On models that support this, inserts count new columns into the model before the given column. The items in each new column will be children of the item represented by the parent model index.

Calls C++ function: virtual bool QAbstractItemModel::insertColumns(int column, int count, const QModelIndex& parent = …).

C++ documentation:

On models that support this, inserts count new columns into the model before the given column. The items in each new column will be children of the item represented by the parent model index.

If column is 0, the columns are prepended to any existing columns.

If column is columnCount(), the columns are appended to any existing columns.

If parent has no children, a single row with count columns is inserted.

Returns true if the columns were successfully inserted; otherwise returns false.

The base class implementation does nothing and returns false.

If you implement your own model, you can reimplement this function if you want to support insertions. Alternatively, you can provide your own API for altering the data.

See also insertRows(), removeColumns(), beginInsertColumns(), and endInsertColumns().

source

pub unsafe fn insert_columns_2a(&self, column: c_int, count: c_int) -> bool

On models that support this, inserts count new columns into the model before the given column. The items in each new column will be children of the item represented by the parent model index.

Calls C++ function: virtual bool QAbstractItemModel::insertColumns(int column, int count).

C++ documentation:

On models that support this, inserts count new columns into the model before the given column. The items in each new column will be children of the item represented by the parent model index.

If column is 0, the columns are prepended to any existing columns.

If column is columnCount(), the columns are appended to any existing columns.

If parent has no children, a single row with count columns is inserted.

Returns true if the columns were successfully inserted; otherwise returns false.

The base class implementation does nothing and returns false.

If you implement your own model, you can reimplement this function if you want to support insertions. Alternatively, you can provide your own API for altering the data.

See also insertRows(), removeColumns(), beginInsertColumns(), and endInsertColumns().

source

pub unsafe fn insert_row_2a( &self, row: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Inserts a single row before the given row in the child items of the parent specified.

Calls C++ function: bool QAbstractItemModel::insertRow(int row, const QModelIndex& parent = …).

C++ documentation:

Inserts a single row before the given row in the child items of the parent specified.

Note: This function calls the virtual method insertRows.

Returns true if the row is inserted; otherwise returns false.

See also insertRows(), insertColumn(), and removeRow().

source

pub unsafe fn insert_row_1a(&self, row: c_int) -> bool

Inserts a single row before the given row in the child items of the parent specified.

Calls C++ function: bool QAbstractItemModel::insertRow(int row).

C++ documentation:

Inserts a single row before the given row in the child items of the parent specified.

Note: This function calls the virtual method insertRows.

Returns true if the row is inserted; otherwise returns false.

See also insertRows(), insertColumn(), and removeRow().

source

pub unsafe fn insert_rows_3a( &self, row: c_int, count: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Note: The base class implementation of this function does nothing and returns false.

Calls C++ function: virtual bool QAbstractItemModel::insertRows(int row, int count, const QModelIndex& parent = …).

C++ documentation:

Note: The base class implementation of this function does nothing and returns false.

On models that support this, inserts count rows into the model before the given row. Items in the new row will be children of the item represented by the parent model index.

If row is 0, the rows are prepended to any existing rows in the parent.

If row is rowCount(), the rows are appended to any existing rows in the parent.

If parent has no children, a single column with count rows is inserted.

Returns true if the rows were successfully inserted; otherwise returns false.

If you implement your own model, you can reimplement this function if you want to support insertions. Alternatively, you can provide your own API for altering the data. In either case, you will need to call beginInsertRows() and endInsertRows() to notify other components that the model has changed.

See also insertColumns(), removeRows(), beginInsertRows(), and endInsertRows().

source

pub unsafe fn insert_rows_2a(&self, row: c_int, count: c_int) -> bool

Note: The base class implementation of this function does nothing and returns false.

Calls C++ function: virtual bool QAbstractItemModel::insertRows(int row, int count).

C++ documentation:

Note: The base class implementation of this function does nothing and returns false.

On models that support this, inserts count rows into the model before the given row. Items in the new row will be children of the item represented by the parent model index.

If row is 0, the rows are prepended to any existing rows in the parent.

If row is rowCount(), the rows are appended to any existing rows in the parent.

If parent has no children, a single column with count rows is inserted.

Returns true if the rows were successfully inserted; otherwise returns false.

If you implement your own model, you can reimplement this function if you want to support insertions. Alternatively, you can provide your own API for altering the data. In either case, you will need to call beginInsertRows() and endInsertRows() to notify other components that the model has changed.

See also insertColumns(), removeRows(), beginInsertRows(), and endInsertRows().

source

pub unsafe fn item_data( &self, index: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QMapOfIntQVariant>

Returns a map with values for all predefined roles in the model for the item at the given index.

Calls C++ function: virtual QMap<int, QVariant> QAbstractItemModel::itemData(const QModelIndex& index) const.

C++ documentation:

Returns a map with values for all predefined roles in the model for the item at the given index.

Reimplement this function if you want to extend the default behavior of this function to include custom roles in the map.

See also setItemData(), Qt::ItemDataRole, and data().

source

pub unsafe fn match_5a( &self, start: impl CastInto<Ref<QModelIndex>>, role: c_int, value: impl CastInto<Ref<QVariant>>, hits: c_int, flags: QFlags<MatchFlag> ) -> CppBox<QListOfQModelIndex>

Returns a list of indexes for the items in the column of the start index where data stored under the given role matches the specified value. The way the search is performed is defined by the flags given. The list that is returned may be empty. Note also that the order of results in the list may not correspond to the order in the model, if for example a proxy model is used. The order of the results can not be relied upon.

Calls C++ function: virtual QList<QModelIndex> QAbstractItemModel::match(const QModelIndex& start, int role, const QVariant& value, int hits = …, QFlags<Qt::MatchFlag> flags = …) const.

C++ documentation:

Returns a list of indexes for the items in the column of the start index where data stored under the given role matches the specified value. The way the search is performed is defined by the flags given. The list that is returned may be empty. Note also that the order of results in the list may not correspond to the order in the model, if for example a proxy model is used. The order of the results can not be relied upon.

The search begins from the start index, and continues until the number of matching data items equals hits, the search reaches the last row, or the search reaches start again - depending on whether MatchWrap is specified in flags. If you want to search for all matching items, use hits = -1.

By default, this function will perform a wrapping, string-based comparison on all items, searching for items that begin with the search term specified by value.

Note: The default implementation of this function only searches columns. Reimplement this function to include a different search behavior.

source

pub unsafe fn match_4a( &self, start: impl CastInto<Ref<QModelIndex>>, role: c_int, value: impl CastInto<Ref<QVariant>>, hits: c_int ) -> CppBox<QListOfQModelIndex>

Returns a list of indexes for the items in the column of the start index where data stored under the given role matches the specified value. The way the search is performed is defined by the flags given. The list that is returned may be empty. Note also that the order of results in the list may not correspond to the order in the model, if for example a proxy model is used. The order of the results can not be relied upon.

Calls C++ function: virtual QList<QModelIndex> QAbstractItemModel::match(const QModelIndex& start, int role, const QVariant& value, int hits = …) const.

C++ documentation:

Returns a list of indexes for the items in the column of the start index where data stored under the given role matches the specified value. The way the search is performed is defined by the flags given. The list that is returned may be empty. Note also that the order of results in the list may not correspond to the order in the model, if for example a proxy model is used. The order of the results can not be relied upon.

The search begins from the start index, and continues until the number of matching data items equals hits, the search reaches the last row, or the search reaches start again - depending on whether MatchWrap is specified in flags. If you want to search for all matching items, use hits = -1.

By default, this function will perform a wrapping, string-based comparison on all items, searching for items that begin with the search term specified by value.

Note: The default implementation of this function only searches columns. Reimplement this function to include a different search behavior.

source

pub unsafe fn match_3a( &self, start: impl CastInto<Ref<QModelIndex>>, role: c_int, value: impl CastInto<Ref<QVariant>> ) -> CppBox<QListOfQModelIndex>

Returns a list of indexes for the items in the column of the start index where data stored under the given role matches the specified value. The way the search is performed is defined by the flags given. The list that is returned may be empty. Note also that the order of results in the list may not correspond to the order in the model, if for example a proxy model is used. The order of the results can not be relied upon.

Calls C++ function: virtual QList<QModelIndex> QAbstractItemModel::match(const QModelIndex& start, int role, const QVariant& value) const.

C++ documentation:

Returns a list of indexes for the items in the column of the start index where data stored under the given role matches the specified value. The way the search is performed is defined by the flags given. The list that is returned may be empty. Note also that the order of results in the list may not correspond to the order in the model, if for example a proxy model is used. The order of the results can not be relied upon.

The search begins from the start index, and continues until the number of matching data items equals hits, the search reaches the last row, or the search reaches start again - depending on whether MatchWrap is specified in flags. If you want to search for all matching items, use hits = -1.

By default, this function will perform a wrapping, string-based comparison on all items, searching for items that begin with the search term specified by value.

Note: The default implementation of this function only searches columns. Reimplement this function to include a different search behavior.

source

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>

Calls C++ function: virtual const QMetaObject* QAbstractItemModel::metaObject() const.

source

pub unsafe fn mime_data( &self, indexes: impl CastInto<Ref<QListOfQModelIndex>> ) -> QPtr<QMimeData>

Returns an object that contains serialized items of data corresponding to the list of indexes specified. The format used to describe the encoded data is obtained from the mimeTypes() function. This default implementation uses the default MIME type returned by the default implementation of mimeTypes(). If you reimplement mimeTypes() in your custom model to return more MIME types, reimplement this function to make use of them.

Calls C++ function: virtual QMimeData* QAbstractItemModel::mimeData(const QList<QModelIndex>& indexes) const.

C++ documentation:

Returns an object that contains serialized items of data corresponding to the list of indexes specified. The format used to describe the encoded data is obtained from the mimeTypes() function. This default implementation uses the default MIME type returned by the default implementation of mimeTypes(). If you reimplement mimeTypes() in your custom model to return more MIME types, reimplement this function to make use of them.

If the list of indexes is empty, or there are no supported MIME types, 0 is returned rather than a serialized empty list.

See also mimeTypes() and dropMimeData().

source

pub unsafe fn mime_types(&self) -> CppBox<QStringList>

Returns the list of allowed MIME types. By default, the built-in models and views use an internal MIME type: application/x-qabstractitemmodeldatalist.

Calls C++ function: virtual QStringList QAbstractItemModel::mimeTypes() const.

C++ documentation:

Returns the list of allowed MIME types. By default, the built-in models and views use an internal MIME type: application/x-qabstractitemmodeldatalist.

When implementing drag and drop support in a custom model, if you will return data in formats other than the default internal MIME type, reimplement this function to return your list of MIME types.

If you reimplement this function in your custom model, you must also reimplement the member functions that call it: mimeData() and dropMimeData().

See also mimeData() and dropMimeData().

source

pub unsafe fn move_column( &self, source_parent: impl CastInto<Ref<QModelIndex>>, source_column: c_int, destination_parent: impl CastInto<Ref<QModelIndex>>, destination_child: c_int ) -> bool

On models that support this, moves sourceColumn from sourceParent to destinationChild under destinationParent.

Calls C++ function: bool QAbstractItemModel::moveColumn(const QModelIndex& sourceParent, int sourceColumn, const QModelIndex& destinationParent, int destinationChild).

C++ documentation:

On models that support this, moves sourceColumn from sourceParent to destinationChild under destinationParent.

Returns true if the columns were successfully moved; otherwise returns false.

See also moveColumns() and moveRow().

source

pub unsafe fn move_columns( &self, source_parent: impl CastInto<Ref<QModelIndex>>, source_column: c_int, count: c_int, destination_parent: impl CastInto<Ref<QModelIndex>>, destination_child: c_int ) -> bool

On models that support this, moves count columns starting with the given sourceColumn under parent sourceParent to column destinationChild under parent destinationParent.

Calls C++ function: virtual bool QAbstractItemModel::moveColumns(const QModelIndex& sourceParent, int sourceColumn, int count, const QModelIndex& destinationParent, int destinationChild).

C++ documentation:

On models that support this, moves count columns starting with the given sourceColumn under parent sourceParent to column destinationChild under parent destinationParent.

Returns true if the columns were successfully moved; otherwise returns false.

The base class implementation does nothing and returns false.

If you implement your own model, you can reimplement this function if you want to support moving. Alternatively, you can provide your own API for altering the data.

See also beginMoveColumns() and endMoveColumns().

source

pub unsafe fn move_row( &self, source_parent: impl CastInto<Ref<QModelIndex>>, source_row: c_int, destination_parent: impl CastInto<Ref<QModelIndex>>, destination_child: c_int ) -> bool

On models that support this, moves sourceRow from sourceParent to destinationChild under destinationParent.

Calls C++ function: bool QAbstractItemModel::moveRow(const QModelIndex& sourceParent, int sourceRow, const QModelIndex& destinationParent, int destinationChild).

C++ documentation:

On models that support this, moves sourceRow from sourceParent to destinationChild under destinationParent.

Returns true if the rows were successfully moved; otherwise returns false.

See also moveRows() and moveColumn().

source

pub unsafe fn move_rows( &self, source_parent: impl CastInto<Ref<QModelIndex>>, source_row: c_int, count: c_int, destination_parent: impl CastInto<Ref<QModelIndex>>, destination_child: c_int ) -> bool

On models that support this, moves count rows starting with the given sourceRow under parent sourceParent to row destinationChild under parent destinationParent.

Calls C++ function: virtual bool QAbstractItemModel::moveRows(const QModelIndex& sourceParent, int sourceRow, int count, const QModelIndex& destinationParent, int destinationChild).

C++ documentation:

On models that support this, moves count rows starting with the given sourceRow under parent sourceParent to row destinationChild under parent destinationParent.

Returns true if the rows were successfully moved; otherwise returns false.

The base class implementation does nothing and returns false.

If you implement your own model, you can reimplement this function if you want to support moving. Alternatively, you can provide your own API for altering the data.

See also beginMoveRows() and endMoveRows().

source

pub unsafe fn parent( &self, child: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QModelIndex>

Returns the parent of the model item with the given index. If the item has no parent, an invalid QModelIndex is returned.

Calls C++ function: pure virtual QModelIndex QAbstractItemModel::parent(const QModelIndex& child) const.

C++ documentation:

Returns the parent of the model item with the given index. If the item has no parent, an invalid QModelIndex is returned.

A common convention used in models that expose tree data structures is that only items in the first column have children. For that case, when reimplementing this function in a subclass the column of the returned QModelIndex would be 0.

When reimplementing this function in a subclass, be careful to avoid calling QModelIndex member functions, such as QModelIndex::parent(), since indexes belonging to your model will simply call your implementation, leading to infinite recursion.

See also createIndex().

source

pub unsafe fn qt_metacall( &self, arg1: Call, arg2: c_int, arg3: *mut *mut c_void ) -> c_int

Calls C++ function: virtual int QAbstractItemModel::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

source

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void

Calls C++ function: virtual void* QAbstractItemModel::qt_metacast(const char* arg1).

source

pub unsafe fn remove_column_2a( &self, column: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Removes the given column from the child items of the parent specified.

Calls C++ function: bool QAbstractItemModel::removeColumn(int column, const QModelIndex& parent = …).

C++ documentation:

Removes the given column from the child items of the parent specified.

Returns true if the column is removed; otherwise returns false.

See also removeColumns(), removeRow(), and insertColumn().

source

pub unsafe fn remove_column_1a(&self, column: c_int) -> bool

Removes the given column from the child items of the parent specified.

Calls C++ function: bool QAbstractItemModel::removeColumn(int column).

C++ documentation:

Removes the given column from the child items of the parent specified.

Returns true if the column is removed; otherwise returns false.

See also removeColumns(), removeRow(), and insertColumn().

source

pub unsafe fn remove_columns_3a( &self, column: c_int, count: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

On models that support this, removes count columns starting with the given column under parent parent from the model.

Calls C++ function: virtual bool QAbstractItemModel::removeColumns(int column, int count, const QModelIndex& parent = …).

C++ documentation:

On models that support this, removes count columns starting with the given column under parent parent from the model.

Returns true if the columns were successfully removed; otherwise returns false.

The base class implementation does nothing and returns false.

If you implement your own model, you can reimplement this function if you want to support removing. Alternatively, you can provide your own API for altering the data.

See also removeColumn(), removeRows(), insertColumns(), beginRemoveColumns(), and endRemoveColumns().

source

pub unsafe fn remove_columns_2a(&self, column: c_int, count: c_int) -> bool

On models that support this, removes count columns starting with the given column under parent parent from the model.

Calls C++ function: virtual bool QAbstractItemModel::removeColumns(int column, int count).

C++ documentation:

On models that support this, removes count columns starting with the given column under parent parent from the model.

Returns true if the columns were successfully removed; otherwise returns false.

The base class implementation does nothing and returns false.

If you implement your own model, you can reimplement this function if you want to support removing. Alternatively, you can provide your own API for altering the data.

See also removeColumn(), removeRows(), insertColumns(), beginRemoveColumns(), and endRemoveColumns().

source

pub unsafe fn remove_row_2a( &self, row: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

Removes the given row from the child items of the parent specified.

Calls C++ function: bool QAbstractItemModel::removeRow(int row, const QModelIndex& parent = …).

C++ documentation:

Removes the given row from the child items of the parent specified.

Returns true if the row is removed; otherwise returns false.

This is a convenience function that calls removeRows(). The QAbstractItemModel implementation of removeRows() does nothing.

See also removeRows(), removeColumn(), and insertRow().

source

pub unsafe fn remove_row_1a(&self, row: c_int) -> bool

Removes the given row from the child items of the parent specified.

Calls C++ function: bool QAbstractItemModel::removeRow(int row).

C++ documentation:

Removes the given row from the child items of the parent specified.

Returns true if the row is removed; otherwise returns false.

This is a convenience function that calls removeRows(). The QAbstractItemModel implementation of removeRows() does nothing.

See also removeRows(), removeColumn(), and insertRow().

source

pub unsafe fn remove_rows_3a( &self, row: c_int, count: c_int, parent: impl CastInto<Ref<QModelIndex>> ) -> bool

On models that support this, removes count rows starting with the given row under parent parent from the model.

Calls C++ function: virtual bool QAbstractItemModel::removeRows(int row, int count, const QModelIndex& parent = …).

C++ documentation:

On models that support this, removes count rows starting with the given row under parent parent from the model.

Returns true if the rows were successfully removed; otherwise returns false.

The base class implementation does nothing and returns false.

If you implement your own model, you can reimplement this function if you want to support removing. Alternatively, you can provide your own API for altering the data.

See also removeRow(), removeColumns(), insertColumns(), beginRemoveRows(), and endRemoveRows().

source

pub unsafe fn remove_rows_2a(&self, row: c_int, count: c_int) -> bool

On models that support this, removes count rows starting with the given row under parent parent from the model.

Calls C++ function: virtual bool QAbstractItemModel::removeRows(int row, int count).

C++ documentation:

On models that support this, removes count rows starting with the given row under parent parent from the model.

Returns true if the rows were successfully removed; otherwise returns false.

The base class implementation does nothing and returns false.

If you implement your own model, you can reimplement this function if you want to support removing. Alternatively, you can provide your own API for altering the data.

See also removeRow(), removeColumns(), insertColumns(), beginRemoveRows(), and endRemoveRows().

source

pub unsafe fn revert(&self)

Lets the model know that it should discard cached information. This function is typically used for row editing.

Calls C++ function: virtual [slot] void QAbstractItemModel::revert().

C++ documentation:

Lets the model know that it should discard cached information. This function is typically used for row editing.

See also submit().

source

pub unsafe fn role_names(&self) -> CppBox<QHashOfIntQByteArray>

Returns the model's role names.

Calls C++ function: virtual QHash<int, QByteArray> QAbstractItemModel::roleNames() const.

C++ documentation:

Returns the model’s role names.

The default role names set by Qt are:

Qt RoleQML Role Name
Qt::DisplayRoledisplay
Qt::DecorationRoledecoration
Qt::EditRoleedit
Qt::ToolTipRoletoolTip
Qt::StatusTipRolestatusTip
Qt::WhatsThisRolewhatsThis

This function was introduced in Qt 4.6.

See also setRoleNames().

source

pub unsafe fn row_count_1a( &self, parent: impl CastInto<Ref<QModelIndex>> ) -> c_int

Returns the number of rows under the given parent. When the parent is valid it means that rowCount is returning the number of children of parent.

Calls C++ function: pure virtual int QAbstractItemModel::rowCount(const QModelIndex& parent = …) const.

C++ documentation:

Returns the number of rows under the given parent. When the parent is valid it means that rowCount is returning the number of children of parent.

Note: When implementing a table based model, rowCount() should return 0 when the parent is valid.

See also columnCount().

source

pub unsafe fn row_count_0a(&self) -> c_int

Returns the number of rows under the given parent. When the parent is valid it means that rowCount is returning the number of children of parent.

Calls C++ function: pure virtual int QAbstractItemModel::rowCount() const.

C++ documentation:

Returns the number of rows under the given parent. When the parent is valid it means that rowCount is returning the number of children of parent.

Note: When implementing a table based model, rowCount() should return 0 when the parent is valid.

See also columnCount().

source

pub unsafe fn set_data_3a( &self, index: impl CastInto<Ref<QModelIndex>>, value: impl CastInto<Ref<QVariant>>, role: c_int ) -> bool

Sets the role data for the item at index to value.

Calls C++ function: virtual bool QAbstractItemModel::setData(const QModelIndex& index, const QVariant& value, int role = …).

C++ documentation:

Sets the role data for the item at index to value.

Returns true if successful; otherwise returns false.

The dataChanged() signal should be emitted if the data was successfully set.

The base class implementation returns false. This function and data() must be reimplemented for editable models.

See also Qt::ItemDataRole, data(), and itemData().

source

pub unsafe fn set_data_2a( &self, index: impl CastInto<Ref<QModelIndex>>, value: impl CastInto<Ref<QVariant>> ) -> bool

Sets the role data for the item at index to value.

Calls C++ function: virtual bool QAbstractItemModel::setData(const QModelIndex& index, const QVariant& value).

C++ documentation:

Sets the role data for the item at index to value.

Returns true if successful; otherwise returns false.

The dataChanged() signal should be emitted if the data was successfully set.

The base class implementation returns false. This function and data() must be reimplemented for editable models.

See also Qt::ItemDataRole, data(), and itemData().

source

pub unsafe fn set_header_data_4a( &self, section: c_int, orientation: Orientation, value: impl CastInto<Ref<QVariant>>, role: c_int ) -> bool

Sets the data for the given role and section in the header with the specified orientation to the value supplied.

Calls C++ function: virtual bool QAbstractItemModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role = …).

C++ documentation:

Sets the data for the given role and section in the header with the specified orientation to the value supplied.

Returns true if the header's data was updated; otherwise returns false.

When reimplementing this function, the headerDataChanged() signal must be emitted explicitly.

See also Qt::ItemDataRole and headerData().

source

pub unsafe fn set_header_data_3a( &self, section: c_int, orientation: Orientation, value: impl CastInto<Ref<QVariant>> ) -> bool

Sets the data for the given role and section in the header with the specified orientation to the value supplied.

Calls C++ function: virtual bool QAbstractItemModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant& value).

C++ documentation:

Sets the data for the given role and section in the header with the specified orientation to the value supplied.

Returns true if the header's data was updated; otherwise returns false.

When reimplementing this function, the headerDataChanged() signal must be emitted explicitly.

See also Qt::ItemDataRole and headerData().

source

pub unsafe fn set_item_data( &self, index: impl CastInto<Ref<QModelIndex>>, roles: impl CastInto<Ref<QMapOfIntQVariant>> ) -> bool

Sets the role data for the item at index to the associated value in roles, for every Qt::ItemDataRole.

Calls C++ function: virtual bool QAbstractItemModel::setItemData(const QModelIndex& index, const QMap<int, QVariant>& roles).

C++ documentation:

Sets the role data for the item at index to the associated value in roles, for every Qt::ItemDataRole.

Returns true if successful; otherwise returns false.

Roles that are not in roles will not be modified.

See also setData(), data(), and itemData().

source

pub unsafe fn sibling( &self, row: c_int, column: c_int, idx: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QModelIndex>

Returns the sibling at row and column for the item at index, or an invalid QModelIndex if there is no sibling at that location.

Calls C++ function: virtual QModelIndex QAbstractItemModel::sibling(int row, int column, const QModelIndex& idx) const.

C++ documentation:

Returns the sibling at row and column for the item at index, or an invalid QModelIndex if there is no sibling at that location.

sibling() is just a convenience function that finds the item's parent, and uses it to retrieve the index of the child item in the specified row and column.

This method can optionally be overridden for implementation-specific optimization.

See also index(), QModelIndex::row(), and QModelIndex::column().

source

pub unsafe fn sort_2a(&self, column: c_int, order: SortOrder)

Sorts the model by column in the given order.

Calls C++ function: virtual void QAbstractItemModel::sort(int column, Qt::SortOrder order = …).

C++ documentation:

Sorts the model by column in the given order.

The base class implementation does nothing.

source

pub unsafe fn sort_1a(&self, column: c_int)

Sorts the model by column in the given order.

Calls C++ function: virtual void QAbstractItemModel::sort(int column).

C++ documentation:

Sorts the model by column in the given order.

The base class implementation does nothing.

source

pub unsafe fn span( &self, index: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QSize>

Returns the row and column span of the item represented by index.

Calls C++ function: virtual QSize QAbstractItemModel::span(const QModelIndex& index) const.

C++ documentation:

Returns the row and column span of the item represented by index.

Note: Currently, span is not used.

source

pub unsafe fn submit(&self) -> bool

Lets the model know that it should submit cached information to permanent storage. This function is typically used for row editing.

Calls C++ function: virtual [slot] bool QAbstractItemModel::submit().

C++ documentation:

Lets the model know that it should submit cached information to permanent storage. This function is typically used for row editing.

Returns true if there is no error; otherwise returns false.

See also revert().

source

pub unsafe fn supported_drag_actions(&self) -> QFlags<DropAction>

Returns the actions supported by the data in this model.

Calls C++ function: virtual QFlags<Qt::DropAction> QAbstractItemModel::supportedDragActions() const.

C++ documentation:

Returns the actions supported by the data in this model.

The default implementation returns supportedDropActions(). Reimplement this function if you wish to support additional actions.

supportedDragActions() is used by QAbstractItemView::startDrag() as the default values when a drag occurs.

See also setSupportedDragActions(), Qt::DropActions, and Using drag and drop with item views.

source

pub unsafe fn supported_drop_actions(&self) -> QFlags<DropAction>

Returns the drop actions supported by this model.

Calls C++ function: virtual QFlags<Qt::DropAction> QAbstractItemModel::supportedDropActions() const.

C++ documentation:

Returns the drop actions supported by this model.

The default implementation returns Qt::CopyAction. Reimplement this function if you wish to support additional actions. You must also reimplement the dropMimeData() function to handle the additional operations.

This function was introduced in Qt 4.2.

See also dropMimeData(), Qt::DropActions, and Using drag and drop with item views.

Methods from Deref<Target = QObject>§

source

pub unsafe fn find_child<T>( &self, name: &str ) -> Result<QPtr<T>, FindChildError>

Finds a child of self with the specified object name and casts it to type T.

The search is performed recursively. If there is more than one child matching the search, the most direct ancestor is returned. If there are several direct ancestors, it is undefined which one will be returned.

Returns an error if there is no child object with object name name or the found object cannot be cast to T.

source

pub fn destroyed(&self) -> Signal<(*mut QObject,)>

This signal is emitted immediately before the object obj is destroyed, and can not be blocked.

Returns a built-in Qt signal QObject::destroyed that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted immediately before the object obj is destroyed, and can not be blocked.

All the objects's children are destroyed immediately after this signal is emitted.

See also deleteLater() and QPointer.

source

pub fn object_name_changed(&self) -> Signal<(*const QString,)>

This signal is emitted after the object's name has been changed. The new object name is passed as objectName.

Returns a built-in Qt signal QObject::objectNameChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted after the object’s name has been changed. The new object name is passed as objectName.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

Note: Notifier signal for property objectName.

See also QObject::objectName.

source

pub fn slot_delete_later(&self) -> Receiver<()>

Schedules this object for deletion.

Returns a built-in Qt slot QObject::deleteLater that can be passed to qt_core::Signal::connect.

C++ documentation:

Schedules this object for deletion.

The object will be deleted when control returns to the event loop. If the event loop is not running when this function is called (e.g. deleteLater() is called on an object before QCoreApplication::exec()), the object will be deleted once the event loop is started. If deleteLater() is called after the main event loop has stopped, the object will not be deleted. Since Qt 4.8, if deleteLater() is called on an object that lives in a thread with no running event loop, the object will be destroyed when the thread finishes.

Note that entering and leaving a new event loop (e.g., by opening a modal dialog) will not perform the deferred deletion; for the object to be deleted, the control must return to the event loop from which deleteLater() was called.

Note: It is safe to call this function more than once; when the first deferred deletion event is delivered, any pending events for the object are removed from the event queue.

See also destroyed() and QPointer.

source

pub unsafe fn block_signals(&self, b: bool) -> bool

If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). If block is false, no such blocking will occur.

Calls C++ function: bool QObject::blockSignals(bool b).

C++ documentation:

If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). If block is false, no such blocking will occur.

The return value is the previous value of signalsBlocked().

Note that the destroyed() signal will be emitted even if the signals for this object have been blocked.

Signals emitted while being blocked are not buffered.

See also signalsBlocked() and QSignalBlocker.

source

pub unsafe fn children(&self) -> Ref<QListOfQObject>

Returns a list of child objects. The QObjectList class is defined in the <QObject> header file as the following:

Calls C++ function: const QList<QObject*>& QObject::children() const.

C++ documentation:

Returns a list of child objects. The QObjectList class is defined in the <QObject> header file as the following:


  typedef QList<QObject*> QObjectList;

The first child added is the first object in the list and the last child added is the last object in the list, i.e. new children are appended at the end.

Note that the list order changes when QWidget children are raised or lowered. A widget that is raised becomes the last object in the list, and a widget that is lowered becomes the first object in the list.

See also findChild(), findChildren(), parent(), and setParent().

source

pub unsafe fn delete_later(&self)

Schedules this object for deletion.

Calls C++ function: [slot] void QObject::deleteLater().

C++ documentation:

Schedules this object for deletion.

The object will be deleted when control returns to the event loop. If the event loop is not running when this function is called (e.g. deleteLater() is called on an object before QCoreApplication::exec()), the object will be deleted once the event loop is started. If deleteLater() is called after the main event loop has stopped, the object will not be deleted. Since Qt 4.8, if deleteLater() is called on an object that lives in a thread with no running event loop, the object will be destroyed when the thread finishes.

Note that entering and leaving a new event loop (e.g., by opening a modal dialog) will not perform the deferred deletion; for the object to be deleted, the control must return to the event loop from which deleteLater() was called.

Note: It is safe to call this function more than once; when the first deferred deletion event is delivered, any pending events for the object are removed from the event queue.

See also destroyed() and QPointer.

source

pub unsafe fn disconnect_char_q_object_char( &self, signal: *const c_char, receiver: impl CastInto<Ptr<QObject>>, member: *const c_char ) -> bool

This function overloads disconnect().

Calls C++ function: bool QObject::disconnect(const char* signal = …, const QObject* receiver = …, const char* member = …) const.

C++ documentation:

This function overloads disconnect().

Disconnects signal from method of receiver.

A signal-slot connection is removed when either of the objects involved are destroyed.

Note: This function is thread-safe.

source

pub unsafe fn disconnect_q_object_char( &self, receiver: impl CastInto<Ptr<QObject>>, member: *const c_char ) -> bool

This function overloads disconnect().

Calls C++ function: bool QObject::disconnect(const QObject* receiver, const char* member = …) const.

C++ documentation:

This function overloads disconnect().

Disconnects all signals in this object from receiver's method.

A signal-slot connection is removed when either of the objects involved are destroyed.

source

pub unsafe fn disconnect_char_q_object( &self, signal: *const c_char, receiver: impl CastInto<Ptr<QObject>> ) -> bool

This function overloads disconnect().

Calls C++ function: bool QObject::disconnect(const char* signal = …, const QObject* receiver = …) const.

C++ documentation:

This function overloads disconnect().

Disconnects signal from method of receiver.

A signal-slot connection is removed when either of the objects involved are destroyed.

Note: This function is thread-safe.

source

pub unsafe fn disconnect_char(&self, signal: *const c_char) -> bool

This function overloads disconnect().

Calls C++ function: bool QObject::disconnect(const char* signal = …) const.

C++ documentation:

This function overloads disconnect().

Disconnects signal from method of receiver.

A signal-slot connection is removed when either of the objects involved are destroyed.

Note: This function is thread-safe.

source

pub unsafe fn disconnect(&self) -> bool

This function overloads disconnect().

Calls C++ function: bool QObject::disconnect() const.

C++ documentation:

This function overloads disconnect().

Disconnects signal from method of receiver.

A signal-slot connection is removed when either of the objects involved are destroyed.

Note: This function is thread-safe.

source

pub unsafe fn disconnect_q_object( &self, receiver: impl CastInto<Ptr<QObject>> ) -> bool

This function overloads disconnect().

Calls C++ function: bool QObject::disconnect(const QObject* receiver) const.

C++ documentation:

This function overloads disconnect().

Disconnects all signals in this object from receiver's method.

A signal-slot connection is removed when either of the objects involved are destroyed.

source

pub unsafe fn dump_object_info_mut(&self)

Dumps information about signal connections, etc. for this object to the debug output.

Calls C++ function: void QObject::dumpObjectInfo().

C++ documentation:

Dumps information about signal connections, etc. for this object to the debug output.

Note: before Qt 5.9, this function was not const.

See also dumpObjectTree().

source

pub unsafe fn dump_object_info(&self)

Dumps information about signal connections, etc. for this object to the debug output.

Calls C++ function: void QObject::dumpObjectInfo() const.

C++ documentation:

Dumps information about signal connections, etc. for this object to the debug output.

Note: before Qt 5.9, this function was not const.

See also dumpObjectTree().

source

pub unsafe fn dump_object_tree_mut(&self)

Dumps a tree of children to the debug output.

Calls C++ function: void QObject::dumpObjectTree().

C++ documentation:

Dumps a tree of children to the debug output.

Note: before Qt 5.9, this function was not const.

See also dumpObjectInfo().

source

pub unsafe fn dump_object_tree(&self)

Dumps a tree of children to the debug output.

Calls C++ function: void QObject::dumpObjectTree() const.

C++ documentation:

Dumps a tree of children to the debug output.

Note: before Qt 5.9, this function was not const.

See also dumpObjectInfo().

source

pub unsafe fn dynamic_property_names(&self) -> CppBox<QListOfQByteArray>

Returns the names of all properties that were dynamically added to the object using setProperty().

Calls C++ function: QList<QByteArray> QObject::dynamicPropertyNames() const.

C++ documentation:

Returns the names of all properties that were dynamically added to the object using setProperty().

This function was introduced in Qt 4.2.

source

pub unsafe fn eq(&self, p: impl CastInto<Ref<QPointerOfQObject>>) -> bool

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

Calls C++ function: bool operator==(QObject* o, const QPointer<QObject>& p).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(QChar c1, QChar c2):

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

source

pub unsafe fn event(&self, event: impl CastInto<Ptr<QEvent>>) -> bool

This virtual function receives events to an object and should return true if the event e was recognized and processed.

Calls C++ function: virtual bool QObject::event(QEvent* event).

C++ documentation:

This virtual function receives events to an object and should return true if the event e was recognized and processed.

The event() function can be reimplemented to customize the behavior of an object.

Make sure you call the parent event class implementation for all the events you did not handle.

Example:

class MyClass : public QWidget { Q_OBJECT

public: MyClass(QWidget *parent = 0); ~MyClass();

bool event(QEvent* ev) { if (ev->type() == QEvent::PolishRequest) { // overwrite handling of PolishRequest if any doThings(); return true; } else if (ev->type() == QEvent::Show) { // complement handling of Show if any doThings2(); QWidget::event(ev); return true; } // Make sure the rest of events are handled return QWidget::event(ev); } };

See also installEventFilter(), timerEvent(), QCoreApplication::sendEvent(), and QCoreApplication::postEvent().

source

pub unsafe fn event_filter( &self, watched: impl CastInto<Ptr<QObject>>, event: impl CastInto<Ptr<QEvent>> ) -> bool

Filters events if this object has been installed as an event filter for the watched object.

Calls C++ function: virtual bool QObject::eventFilter(QObject* watched, QEvent* event).

C++ documentation:

Filters events if this object has been installed as an event filter for the watched object.

In your reimplementation of this function, if you want to filter the event out, i.e. stop it being handled further, return true; otherwise return false.

Example:

class MainWindow : public QMainWindow { public: MainWindow();

protected: bool eventFilter(QObject obj, QEvent ev);

private: QTextEdit *textEdit; };

MainWindow::MainWindow() { textEdit = new QTextEdit; setCentralWidget(textEdit);

textEdit->installEventFilter(this); }

bool MainWindow::eventFilter(QObject obj, QEvent event) { if (obj == textEdit) { if (event->type() == QEvent::KeyPress) { QKeyEvent keyEvent = static_cast<QKeyEvent>(event); qDebug() << “Ate key press” << keyEvent->key(); return true; } else { return false; } } else { // pass the event on to the parent class return QMainWindow::eventFilter(obj, event); } }

Notice in the example above that unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes.

Warning: If you delete the receiver object in this function, be sure to return true. Otherwise, Qt will forward the event to the deleted object and the program might crash.

See also installEventFilter().

source

pub unsafe fn find_child_q_object_2a( &self, a_name: impl CastInto<Ref<QString>>, options: QFlags<FindChildOption> ) -> QPtr<QObject>

Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

Calls C++ function: QObject* QObject::findChild<QObject*>(const QString& aName = …, QFlags<Qt::FindChildOption> options = …) const.

C++ documentation:

Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

If there is more than one child matching the search, the most direct ancestor is returned. If there are several direct ancestors, it is undefined which one will be returned. In that case, findChildren() should be used.

This example returns a child QPushButton of parentWidget named "button1", even if the button isn't a direct child of the parent:

QPushButton button = parentWidget->findChild<QPushButton >(“button1”);

This example returns a QListWidget child of parentWidget:

QListWidget list = parentWidget->findChild<QListWidget >();

This example returns a child QPushButton of parentWidget (its direct parent) named "button1":

QPushButton button = parentWidget->findChild<QPushButton >(“button1”, Qt::FindDirectChildrenOnly);

This example returns a QListWidget child of parentWidget, its direct parent:

QListWidget list = parentWidget->findChild<QListWidget >(QString(), Qt::FindDirectChildrenOnly);

See also findChildren().

source

pub unsafe fn find_child_q_object_1a( &self, a_name: impl CastInto<Ref<QString>> ) -> QPtr<QObject>

Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

Calls C++ function: QObject* QObject::findChild<QObject*>(const QString& aName = …) const.

C++ documentation:

Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

If there is more than one child matching the search, the most direct ancestor is returned. If there are several direct ancestors, it is undefined which one will be returned. In that case, findChildren() should be used.

This example returns a child QPushButton of parentWidget named "button1", even if the button isn't a direct child of the parent:

QPushButton button = parentWidget->findChild<QPushButton >(“button1”);

This example returns a QListWidget child of parentWidget:

QListWidget list = parentWidget->findChild<QListWidget >();

This example returns a child QPushButton of parentWidget (its direct parent) named "button1":

QPushButton button = parentWidget->findChild<QPushButton >(“button1”, Qt::FindDirectChildrenOnly);

This example returns a QListWidget child of parentWidget, its direct parent:

QListWidget list = parentWidget->findChild<QListWidget >(QString(), Qt::FindDirectChildrenOnly);

See also findChildren().

source

pub unsafe fn find_child_q_object_0a(&self) -> QPtr<QObject>

Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

Calls C++ function: QObject* QObject::findChild<QObject*>() const.

C++ documentation:

Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

If there is more than one child matching the search, the most direct ancestor is returned. If there are several direct ancestors, it is undefined which one will be returned. In that case, findChildren() should be used.

This example returns a child QPushButton of parentWidget named "button1", even if the button isn't a direct child of the parent:

QPushButton button = parentWidget->findChild<QPushButton >(“button1”);

This example returns a QListWidget child of parentWidget:

QListWidget list = parentWidget->findChild<QListWidget >();

This example returns a child QPushButton of parentWidget (its direct parent) named "button1":

QPushButton button = parentWidget->findChild<QPushButton >(“button1”, Qt::FindDirectChildrenOnly);

This example returns a QListWidget child of parentWidget, its direct parent:

QListWidget list = parentWidget->findChild<QListWidget >(QString(), Qt::FindDirectChildrenOnly);

See also findChildren().

source

pub unsafe fn find_children_q_object_q_string_q_flags_find_child_option( &self, a_name: impl CastInto<Ref<QString>>, options: QFlags<FindChildOption> ) -> CppBox<QListOfQObject>

Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>(const QString& aName = …, QFlags<Qt::FindChildOption> options = …) const.

C++ documentation:

Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

The following example shows how to find a list of child QWidgets of the specified parentWidget named widgetname:

QList<QWidget > widgets = parentWidget.findChildren<QWidget >(“widgetname”);

This example returns all QPushButtons that are children of parentWidget:

QList<QPushButton > allPButtons = parentWidget.findChildren<QPushButton >();

This example returns all QPushButtons that are immediate children of parentWidget:

QList<QPushButton > childButtons = parentWidget.findChildren<QPushButton >(QString(), Qt::FindDirectChildrenOnly);

See also findChild().

source

pub unsafe fn find_children_q_object_q_reg_exp_q_flags_find_child_option( &self, re: impl CastInto<Ref<QRegExp>>, options: QFlags<FindChildOption> ) -> CppBox<QListOfQObject>

This function overloads findChildren().

Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>(const QRegExp& re, QFlags<Qt::FindChildOption> options = …) const.

C++ documentation:

This function overloads findChildren().

Returns the children of this object that can be cast to type T and that have names matching the regular expression regExp, or an empty list if there are no such objects. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

source

pub unsafe fn find_children_q_object_q_regular_expression_q_flags_find_child_option( &self, re: impl CastInto<Ref<QRegularExpression>>, options: QFlags<FindChildOption> ) -> CppBox<QListOfQObject>

This function overloads findChildren().

Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>(const QRegularExpression& re, QFlags<Qt::FindChildOption> options = …) const.

C++ documentation:

This function overloads findChildren().

Returns the children of this object that can be cast to type T and that have names matching the regular expression re, or an empty list if there are no such objects. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

This function was introduced in Qt 5.0.

source

pub unsafe fn find_children_q_object_q_string( &self, a_name: impl CastInto<Ref<QString>> ) -> CppBox<QListOfQObject>

Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>(const QString& aName = …) const.

C++ documentation:

Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

The following example shows how to find a list of child QWidgets of the specified parentWidget named widgetname:

QList<QWidget > widgets = parentWidget.findChildren<QWidget >(“widgetname”);

This example returns all QPushButtons that are children of parentWidget:

QList<QPushButton > allPButtons = parentWidget.findChildren<QPushButton >();

This example returns all QPushButtons that are immediate children of parentWidget:

QList<QPushButton > childButtons = parentWidget.findChildren<QPushButton >(QString(), Qt::FindDirectChildrenOnly);

See also findChild().

source

pub unsafe fn find_children_q_object(&self) -> CppBox<QListOfQObject>

Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>() const.

C++ documentation:

Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

The following example shows how to find a list of child QWidgets of the specified parentWidget named widgetname:

QList<QWidget > widgets = parentWidget.findChildren<QWidget >(“widgetname”);

This example returns all QPushButtons that are children of parentWidget:

QList<QPushButton > allPButtons = parentWidget.findChildren<QPushButton >();

This example returns all QPushButtons that are immediate children of parentWidget:

QList<QPushButton > childButtons = parentWidget.findChildren<QPushButton >(QString(), Qt::FindDirectChildrenOnly);

See also findChild().

source

pub unsafe fn find_children_q_object_q_reg_exp( &self, re: impl CastInto<Ref<QRegExp>> ) -> CppBox<QListOfQObject>

This function overloads findChildren().

Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>(const QRegExp& re) const.

C++ documentation:

This function overloads findChildren().

Returns the children of this object that can be cast to type T and that have names matching the regular expression regExp, or an empty list if there are no such objects. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

source

pub unsafe fn find_children_q_object_q_regular_expression( &self, re: impl CastInto<Ref<QRegularExpression>> ) -> CppBox<QListOfQObject>

This function overloads findChildren().

Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>(const QRegularExpression& re) const.

C++ documentation:

This function overloads findChildren().

Returns the children of this object that can be cast to type T and that have names matching the regular expression re, or an empty list if there are no such objects. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.

This function was introduced in Qt 5.0.

source

pub unsafe fn inherits(&self, classname: *const c_char) -> bool

Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.

Calls C++ function: bool QObject::inherits(const char* classname) const.

C++ documentation:

Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.

A class is considered to inherit itself.

Example:

QTimer *timer = new QTimer; // QTimer inherits QObject timer->inherits(“QTimer”); // returns true timer->inherits(“QObject”); // returns true timer->inherits(“QAbstractButton”); // returns false

// QVBoxLayout inherits QObject and QLayoutItem QVBoxLayout *layout = new QVBoxLayout; layout->inherits(“QObject”); // returns true layout->inherits(“QLayoutItem”); // returns true (even though QLayoutItem is not a QObject)

If you need to determine whether an object is an instance of a particular class for the purpose of casting it, consider using qobject_cast<Type *>(object) instead.

See also metaObject() and qobject_cast().

source

pub unsafe fn install_event_filter( &self, filter_obj: impl CastInto<Ptr<QObject>> )

Installs an event filter filterObj on this object. For example:

Calls C++ function: void QObject::installEventFilter(QObject* filterObj).

C++ documentation:

Installs an event filter filterObj on this object. For example:


  monitoredObj->installEventFilter(filterObj);

An event filter is an object that receives all events that are sent to this object. The filter can either stop the event or forward it to this object. The event filter filterObj receives events via its eventFilter() function. The eventFilter() function must return true if the event should be filtered, (i.e. stopped); otherwise it must return false.

If multiple event filters are installed on a single object, the filter that was installed last is activated first.

Here's a KeyPressEater class that eats the key presses of its monitored objects:

class KeyPressEater : public QObject { Q_OBJECT ...

protected: bool eventFilter(QObject obj, QEvent event); };

bool KeyPressEater::eventFilter(QObject obj, QEvent event) { if (event->type() == QEvent::KeyPress) { QKeyEvent keyEvent = static_cast<QKeyEvent >(event); qDebug(“Ate key press %d”, keyEvent->key()); return true; } else { // standard event processing return QObject::eventFilter(obj, event); } }

And here's how to install it on two widgets:

KeyPressEater keyPressEater = new KeyPressEater(this); QPushButton pushButton = new QPushButton(this); QListView *listView = new QListView(this);

pushButton->installEventFilter(keyPressEater); listView->installEventFilter(keyPressEater);

The QShortcut class, for example, uses this technique to intercept shortcut key presses.

Warning: If you delete the receiver object in your eventFilter() function, be sure to return true. If you return false, Qt sends the event to the deleted object and the program will crash.

Note that the filtering object must be in the same thread as this object. If filterObj is in a different thread, this function does nothing. If either filterObj or this object are moved to a different thread after calling this function, the event filter will not be called until both objects have the same thread affinity again (it is not removed).

See also removeEventFilter(), eventFilter(), and event().

source

pub unsafe fn is_widget_type(&self) -> bool

Returns true if the object is a widget; otherwise returns false.

Calls C++ function: bool QObject::isWidgetType() const.

C++ documentation:

Returns true if the object is a widget; otherwise returns false.

Calling this function is equivalent to calling inherits("QWidget"), except that it is much faster.

source

pub unsafe fn is_window_type(&self) -> bool

Returns true if the object is a window; otherwise returns false.

Calls C++ function: bool QObject::isWindowType() const.

C++ documentation:

Returns true if the object is a window; otherwise returns false.

Calling this function is equivalent to calling inherits("QWindow"), except that it is much faster.

source

pub unsafe fn kill_timer(&self, id: c_int)

Kills the timer with timer identifier, id.

Calls C++ function: void QObject::killTimer(int id).

C++ documentation:

Kills the timer with timer identifier, id.

The timer identifier is returned by startTimer() when a timer event is started.

See also timerEvent() and startTimer().

source

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>

Returns a pointer to the meta-object of this object.

Calls C++ function: virtual const QMetaObject* QObject::metaObject() const.

C++ documentation:

Returns a pointer to the meta-object of this object.

A meta-object contains information about a class that inherits QObject, e.g. class name, superclass name, properties, signals and slots. Every QObject subclass that contains the Q_OBJECT macro will have a meta-object.

The meta-object information is required by the signal/slot connection mechanism and the property system. The inherits() function also makes use of the meta-object.

If you have no pointer to an actual object instance but still want to access the meta-object of a class, you can use staticMetaObject.

Example:

QObject *obj = new QPushButton; obj->metaObject()->className(); // returns “QPushButton”

QPushButton::staticMetaObject.className(); // returns “QPushButton”

See also staticMetaObject.

source

pub unsafe fn move_to_thread(&self, thread: impl CastInto<Ptr<QThread>>)

Changes the thread affinity for this object and its children. The object cannot be moved if it has a parent. Event processing will continue in the targetThread.

Calls C++ function: void QObject::moveToThread(QThread* thread).

C++ documentation:

Changes the thread affinity for this object and its children. The object cannot be moved if it has a parent. Event processing will continue in the targetThread.

To move an object to the main thread, use QApplication::instance() to retrieve a pointer to the current application, and then use QApplication::thread() to retrieve the thread in which the application lives. For example:

myObject->moveToThread(QApplication::instance()->thread());

If targetThread is zero, all event processing for this object and its children stops.

Note that all active timers for the object will be reset. The timers are first stopped in the current thread and restarted (with the same interval) in the targetThread. As a result, constantly moving an object between threads can postpone timer events indefinitely.

A QEvent::ThreadChange event is sent to this object just before the thread affinity is changed. You can handle this event to perform any special processing. Note that any new events that are posted to this object will be handled in the targetThread.

Warning: This function is not thread-safe; the current thread must be same as the current thread affinity. In other words, this function can only "push" an object from the current thread to another thread, it cannot "pull" an object from any arbitrary thread to the current thread.

See also thread().

source

pub unsafe fn object_name(&self) -> CppBox<QString>

This property holds the name of this object

Calls C++ function: QString QObject::objectName() const.

C++ documentation:

This property holds the name of this object

You can find an object by name (and type) using findChild(). You can find a set of objects with findChildren().

qDebug(“MyClass::setPrecision(): (%s) invalid precision %f”, qPrintable(objectName()), newPrecision);

By default, this property contains an empty string.

Access functions:

QString objectName() const
void setObjectName(const QString &name)

Notifier signal:

void objectNameChanged(const QString &objectName)[see note below]

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also metaObject() and QMetaObject::className().

source

pub unsafe fn parent(&self) -> QPtr<QObject>

Returns a pointer to the parent object.

Calls C++ function: QObject* QObject::parent() const.

C++ documentation:

Returns a pointer to the parent object.

See also setParent() and children().

source

pub unsafe fn property(&self, name: *const c_char) -> CppBox<QVariant>

Returns the value of the object's name property.

Calls C++ function: QVariant QObject::property(const char* name) const.

C++ documentation:

Returns the value of the object’s name property.

If no such property exists, the returned variant is invalid.

Information about all available properties is provided through the metaObject() and dynamicPropertyNames().

See also setProperty(), QVariant::isValid(), metaObject(), and dynamicPropertyNames().

source

pub unsafe fn qt_metacall( &self, arg1: Call, arg2: c_int, arg3: *mut *mut c_void ) -> c_int

Calls C++ function: virtual int QObject::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

source

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void

Calls C++ function: virtual void* QObject::qt_metacast(const char* arg1).

source

pub unsafe fn remove_event_filter(&self, obj: impl CastInto<Ptr<QObject>>)

Removes an event filter object obj from this object. The request is ignored if such an event filter has not been installed.

Calls C++ function: void QObject::removeEventFilter(QObject* obj).

C++ documentation:

Removes an event filter object obj from this object. The request is ignored if such an event filter has not been installed.

All event filters for this object are automatically removed when this object is destroyed.

It is always safe to remove an event filter, even during event filter activation (i.e. from the eventFilter() function).

See also installEventFilter(), eventFilter(), and event().

source

pub unsafe fn set_object_name(&self, name: impl CastInto<Ref<QString>>)

This property holds the name of this object

Calls C++ function: void QObject::setObjectName(const QString& name).

C++ documentation:

This property holds the name of this object

You can find an object by name (and type) using findChild(). You can find a set of objects with findChildren().

qDebug(“MyClass::setPrecision(): (%s) invalid precision %f”, qPrintable(objectName()), newPrecision);

By default, this property contains an empty string.

Access functions:

QString objectName() const
void setObjectName(const QString &name)

Notifier signal:

void objectNameChanged(const QString &objectName)[see note below]

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also metaObject() and QMetaObject::className().

source

pub unsafe fn set_parent(&self, parent: impl CastInto<Ptr<QObject>>)

Makes the object a child of parent.

Calls C++ function: void QObject::setParent(QObject* parent).

C++ documentation:

Makes the object a child of parent.

See also parent() and children().

source

pub unsafe fn set_property( &self, name: *const c_char, value: impl CastInto<Ref<QVariant>> ) -> bool

Sets the value of the object's name property to value.

Calls C++ function: bool QObject::setProperty(const char* name, const QVariant& value).

C++ documentation:

Sets the value of the object’s name property to value.

If the property is defined in the class using Q_PROPERTY then true is returned on success and false otherwise. If the property is not defined using Q_PROPERTY, and therefore not listed in the meta-object, it is added as a dynamic property and false is returned.

Information about all available properties is provided through the metaObject() and dynamicPropertyNames().

Dynamic properties can be queried again using property() and can be removed by setting the property value to an invalid QVariant. Changing the value of a dynamic property causes a QDynamicPropertyChangeEvent to be sent to the object.

Note: Dynamic properties starting with "_q_" are reserved for internal purposes.

See also property(), metaObject(), dynamicPropertyNames(), and QMetaProperty::write().

source

pub unsafe fn signals_blocked(&self) -> bool

Returns true if signals are blocked; otherwise returns false.

Calls C++ function: bool QObject::signalsBlocked() const.

C++ documentation:

Returns true if signals are blocked; otherwise returns false.

Signals are not blocked by default.

See also blockSignals() and QSignalBlocker.

source

pub unsafe fn start_timer_2a( &self, interval: c_int, timer_type: TimerType ) -> c_int

Starts a timer and returns a timer identifier, or returns zero if it could not start a timer.

Calls C++ function: int QObject::startTimer(int interval, Qt::TimerType timerType = …).

C++ documentation:

Starts a timer and returns a timer identifier, or returns zero if it could not start a timer.

A timer event will occur every interval milliseconds until killTimer() is called. If interval is 0, then the timer event occurs once every time there are no more window system events to process.

The virtual timerEvent() function is called with the QTimerEvent event parameter class when a timer event occurs. Reimplement this function to get timer events.

If multiple timers are running, the QTimerEvent::timerId() can be used to find out which timer was activated.

Example:

class MyObject : public QObject { Q_OBJECT

public: MyObject(QObject *parent = 0);

protected: void timerEvent(QTimerEvent *event); };

MyObject::MyObject(QObject *parent) : QObject(parent) { startTimer(50); // 50-millisecond timer startTimer(1000); // 1-second timer startTimer(60000); // 1-minute timer

using namespace std::chrono; startTimer(milliseconds(50)); startTimer(seconds(1)); startTimer(minutes(1));

// since C++14 we can use std::chrono::duration literals, e.g.: startTimer(100ms); startTimer(5s); startTimer(2min); startTimer(1h); }

void MyObject::timerEvent(QTimerEvent *event) { qDebug() << “Timer ID:” << event->timerId(); }

Note that QTimer's accuracy depends on the underlying operating system and hardware. The timerType argument allows you to customize the accuracy of the timer. See Qt::TimerType for information on the different timer types. Most platforms support an accuracy of 20 milliseconds; some provide more. If Qt is unable to deliver the requested number of timer events, it will silently discard some.

The QTimer class provides a high-level programming interface with single-shot timers and timer signals instead of events. There is also a QBasicTimer class that is more lightweight than QTimer and less clumsy than using timer IDs directly.

See also timerEvent(), killTimer(), and QTimer::singleShot().

source

pub unsafe fn start_timer_1a(&self, interval: c_int) -> c_int

Starts a timer and returns a timer identifier, or returns zero if it could not start a timer.

Calls C++ function: int QObject::startTimer(int interval).

C++ documentation:

Starts a timer and returns a timer identifier, or returns zero if it could not start a timer.

A timer event will occur every interval milliseconds until killTimer() is called. If interval is 0, then the timer event occurs once every time there are no more window system events to process.

The virtual timerEvent() function is called with the QTimerEvent event parameter class when a timer event occurs. Reimplement this function to get timer events.

If multiple timers are running, the QTimerEvent::timerId() can be used to find out which timer was activated.

Example:

class MyObject : public QObject { Q_OBJECT

public: MyObject(QObject *parent = 0);

protected: void timerEvent(QTimerEvent *event); };

MyObject::MyObject(QObject *parent) : QObject(parent) { startTimer(50); // 50-millisecond timer startTimer(1000); // 1-second timer startTimer(60000); // 1-minute timer

using namespace std::chrono; startTimer(milliseconds(50)); startTimer(seconds(1)); startTimer(minutes(1));

// since C++14 we can use std::chrono::duration literals, e.g.: startTimer(100ms); startTimer(5s); startTimer(2min); startTimer(1h); }

void MyObject::timerEvent(QTimerEvent *event) { qDebug() << “Timer ID:” << event->timerId(); }

Note that QTimer's accuracy depends on the underlying operating system and hardware. The timerType argument allows you to customize the accuracy of the timer. See Qt::TimerType for information on the different timer types. Most platforms support an accuracy of 20 milliseconds; some provide more. If Qt is unable to deliver the requested number of timer events, it will silently discard some.

The QTimer class provides a high-level programming interface with single-shot timers and timer signals instead of events. There is also a QBasicTimer class that is more lightweight than QTimer and less clumsy than using timer IDs directly.

See also timerEvent(), killTimer(), and QTimer::singleShot().

source

pub unsafe fn thread(&self) -> QPtr<QThread>

Returns the thread in which the object lives.

Calls C++ function: QThread* QObject::thread() const.

C++ documentation:

Returns the thread in which the object lives.

See also moveToThread().

Trait Implementations§

source§

impl CppDeletable for QStringListModel

source§

unsafe fn delete(&self)

The QStringListModel class provides a model that supplies strings to views.

Calls C++ function: [destructor] void QStringListModel::~QStringListModel().

C++ documentation:

The QStringListModel class provides a model that supplies strings to views.

QStringListModel is an editable model that can be used for simple cases where you need to display a number of strings in a view widget, such as a QListView or a QComboBox.

The model provides all the standard functions of an editable model, representing the data in the string list as a model with one column and a number of rows equal to the number of items in the list.

Model indexes corresponding to items are obtained with the index() function, and item flags are obtained with flags(). Item data is read with the data() function and written with setData(). The number of rows (and number of items in the string list) can be found with the rowCount() function.

The model can be constructed with an existing string list, or strings can be set later with the setStringList() convenience function. Strings can also be inserted in the usual way with the insertRows() function, and removed with removeRows(). The contents of the string list can be retrieved with the stringList() convenience function.

An example usage of QStringListModel:

QStringListModel *model = new QStringListModel(); QStringList list; list << “a” << “b” << “c”; model->setStringList(list);

source§

impl Deref for QStringListModel

source§

fn deref(&self) -> &QAbstractListModel

Calls C++ function: QAbstractListModel* static_cast<QAbstractListModel*>(QStringListModel* ptr).

§

type Target = QAbstractListModel

The resulting type after dereferencing.
source§

impl DynamicCast<QStringListModel> for QAbstractItemModel

source§

unsafe fn dynamic_cast(ptr: Ptr<QAbstractItemModel>) -> Ptr<QStringListModel>

Calls C++ function: QStringListModel* dynamic_cast<QStringListModel*>(QAbstractItemModel* ptr).

source§

impl DynamicCast<QStringListModel> for QAbstractListModel

source§

unsafe fn dynamic_cast(ptr: Ptr<QAbstractListModel>) -> Ptr<QStringListModel>

Calls C++ function: QStringListModel* dynamic_cast<QStringListModel*>(QAbstractListModel* ptr).

source§

impl DynamicCast<QStringListModel> for QObject

source§

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QStringListModel>

Calls C++ function: QStringListModel* dynamic_cast<QStringListModel*>(QObject* ptr).

source§

impl StaticDowncast<QStringListModel> for QAbstractItemModel

source§

unsafe fn static_downcast(ptr: Ptr<QAbstractItemModel>) -> Ptr<QStringListModel>

Calls C++ function: QStringListModel* static_cast<QStringListModel*>(QAbstractItemModel* ptr).

source§

impl StaticDowncast<QStringListModel> for QAbstractListModel

source§

unsafe fn static_downcast(ptr: Ptr<QAbstractListModel>) -> Ptr<QStringListModel>

Calls C++ function: QStringListModel* static_cast<QStringListModel*>(QAbstractListModel* ptr).

source§

impl StaticDowncast<QStringListModel> for QObject

source§

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QStringListModel>

Calls C++ function: QStringListModel* static_cast<QStringListModel*>(QObject* ptr).

source§

impl StaticUpcast<QAbstractItemModel> for QStringListModel

source§

unsafe fn static_upcast(ptr: Ptr<QStringListModel>) -> Ptr<QAbstractItemModel>

Calls C++ function: QAbstractItemModel* static_cast<QAbstractItemModel*>(QStringListModel* ptr).

source§

impl StaticUpcast<QAbstractListModel> for QStringListModel

source§

unsafe fn static_upcast(ptr: Ptr<QStringListModel>) -> Ptr<QAbstractListModel>

Calls C++ function: QAbstractListModel* static_cast<QAbstractListModel*>(QStringListModel* ptr).

source§

impl StaticUpcast<QObject> for QStringListModel

source§

unsafe fn static_upcast(ptr: Ptr<QStringListModel>) -> Ptr<QObject>

Calls C++ function: QObject* static_cast<QObject*>(QStringListModel* ptr).

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.