[][src]Struct qt_core::QStringListModel

#[repr(C)]pub struct QStringListModel { /* fields omitted */ }

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);

Methods

impl QStringListModel[src]

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

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().

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

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().

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

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().

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

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().

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

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().

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

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().

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

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

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
[src]

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.

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

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.

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

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.

pub unsafe fn new() -> QBox<QStringListModel>[src]

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);

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

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.

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

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

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

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

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

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().

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

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().

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

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().

pub unsafe fn row_count_0a(&self) -> c_int[src]

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().

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

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().

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

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().

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

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().

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

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().

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

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().

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

Reimplemented from QAbstractItemModel::sort().

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

C++ documentation:

Reimplemented from QAbstractItemModel::sort().

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

Reimplemented from QAbstractItemModel::sort().

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

C++ documentation:

Reimplemented from QAbstractItemModel::sort().

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

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

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().

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

Reimplemented from QAbstractItemModel::supportedDropActions().

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

C++ documentation:

Reimplemented from QAbstractItemModel::supportedDropActions().

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

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

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

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

Methods from Deref<Target = QAbstractListModel>

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
[src]

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().

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

Reimplemented from QAbstractItemModel::flags().

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

C++ documentation:

Reimplemented from QAbstractItemModel::flags().

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

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().

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

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().

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

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().

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

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

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

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

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

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

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

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().

Trait Implementations

impl CppDeletable for QStringListModel[src]

unsafe fn delete(&self)[src]

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);

impl Deref for QStringListModel[src]

type Target = QAbstractListModel

The resulting type after dereferencing.

fn deref(&self) -> &QAbstractListModel[src]

Calls C++ function: QAbstractListModel* static_cast<QAbstractListModel*>(QStringListModel* ptr).

impl DynamicCast<QStringListModel> for QAbstractListModel[src]

unsafe fn dynamic_cast(ptr: Ptr<QAbstractListModel>) -> Ptr<QStringListModel>[src]

Calls C++ function: QStringListModel* dynamic_cast<QStringListModel*>(QAbstractListModel* ptr).

impl DynamicCast<QStringListModel> for QAbstractItemModel[src]

unsafe fn dynamic_cast(ptr: Ptr<QAbstractItemModel>) -> Ptr<QStringListModel>[src]

Calls C++ function: QStringListModel* dynamic_cast<QStringListModel*>(QAbstractItemModel* ptr).

impl DynamicCast<QStringListModel> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QStringListModel>[src]

Calls C++ function: QStringListModel* dynamic_cast<QStringListModel*>(QObject* ptr).

impl StaticDowncast<QStringListModel> for QAbstractListModel[src]

unsafe fn static_downcast(ptr: Ptr<QAbstractListModel>) -> Ptr<QStringListModel>[src]

Calls C++ function: QStringListModel* static_cast<QStringListModel*>(QAbstractListModel* ptr).

impl StaticDowncast<QStringListModel> for QAbstractItemModel[src]

unsafe fn static_downcast(ptr: Ptr<QAbstractItemModel>) -> Ptr<QStringListModel>[src]

Calls C++ function: QStringListModel* static_cast<QStringListModel*>(QAbstractItemModel* ptr).

impl StaticDowncast<QStringListModel> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QStringListModel>[src]

Calls C++ function: QStringListModel* static_cast<QStringListModel*>(QObject* ptr).

impl StaticUpcast<QAbstractItemModel> for QStringListModel[src]

unsafe fn static_upcast(ptr: Ptr<QStringListModel>) -> Ptr<QAbstractItemModel>[src]

Calls C++ function: QAbstractItemModel* static_cast<QAbstractItemModel*>(QStringListModel* ptr).

impl StaticUpcast<QAbstractListModel> for QStringListModel[src]

unsafe fn static_upcast(ptr: Ptr<QStringListModel>) -> Ptr<QAbstractListModel>[src]

Calls C++ function: QAbstractListModel* static_cast<QAbstractListModel*>(QStringListModel* ptr).

impl StaticUpcast<QObject> for QStringListModel[src]

unsafe fn static_upcast(ptr: Ptr<QStringListModel>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QStringListModel* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.