Struct qt_core::QPersistentModelIndex
source · #[repr(C)]pub struct QPersistentModelIndex { /* private fields */ }
Expand description
The QPersistentModelIndex class is used to locate data in a data model.
C++ class: QPersistentModelIndex
.
The QPersistentModelIndex class is used to locate data in a data model.
A QPersistentModelIndex is a model index that can be stored by an application, and later used to access information in a model. Unlike the QModelIndex class, it is safe to store a QPersistentModelIndex since the model will ensure that references to items will continue to be valid as long as they can be accessed by the model.
It is good practice to check that persistent model indexes are valid before using them.
Implementations§
source§impl QPersistentModelIndex
impl QPersistentModelIndex
sourcepub unsafe fn child(&self, row: c_int, column: c_int) -> CppBox<QModelIndex>
pub unsafe fn child(&self, row: c_int, column: c_int) -> CppBox<QModelIndex>
Use QAbstractItemModel::index() instead.
Calls C++ function: QModelIndex QPersistentModelIndex::child(int row, int column) const
.
Use QAbstractItemModel::index() instead.
Returns the child of the model index that is stored in the given row and column.
sourcepub unsafe fn column(&self) -> c_int
pub unsafe fn column(&self) -> c_int
Returns the column this persistent model index refers to.
Calls C++ function: int QPersistentModelIndex::column() const
.
Returns the column this persistent model index refers to.
sourcepub unsafe fn copy_from_q_persistent_model_index(
&self,
other: impl CastInto<Ref<QPersistentModelIndex>>
) -> Ref<QPersistentModelIndex>
pub unsafe fn copy_from_q_persistent_model_index( &self, other: impl CastInto<Ref<QPersistentModelIndex>> ) -> Ref<QPersistentModelIndex>
Sets the persistent model index to refer to the same item in a model as the other persistent model index.
Calls C++ function: QPersistentModelIndex& QPersistentModelIndex::operator=(const QPersistentModelIndex& other)
.
Sets the persistent model index to refer to the same item in a model as the other persistent model index.
sourcepub unsafe fn copy_from_q_model_index(
&self,
other: impl CastInto<Ref<QModelIndex>>
) -> Ref<QPersistentModelIndex>
pub unsafe fn copy_from_q_model_index( &self, other: impl CastInto<Ref<QModelIndex>> ) -> Ref<QPersistentModelIndex>
Sets the persistent model index to refer to the same item in a model as the other model index.
Calls C++ function: QPersistentModelIndex& QPersistentModelIndex::operator=(const QModelIndex& other)
.
Sets the persistent model index to refer to the same item in a model as the other model index.
sourcepub unsafe fn data_1a(&self, role: c_int) -> CppBox<QVariant>
pub unsafe fn data_1a(&self, role: c_int) -> CppBox<QVariant>
Returns the data for the given role for the item referred to by the index.
Calls C++ function: QVariant QPersistentModelIndex::data(int role = …) const
.
Returns the data for the given role for the item referred to by the index.
See also Qt::ItemDataRole and QAbstractItemModel::setData().
sourcepub unsafe fn data_0a(&self) -> CppBox<QVariant>
pub unsafe fn data_0a(&self) -> CppBox<QVariant>
Returns the data for the given role for the item referred to by the index.
Calls C++ function: QVariant QPersistentModelIndex::data() const
.
Returns the data for the given role for the item referred to by the index.
See also Qt::ItemDataRole and QAbstractItemModel::setData().
sourcepub unsafe fn flags(&self) -> QFlags<ItemFlag>
pub unsafe fn flags(&self) -> QFlags<ItemFlag>
Returns the flags for the item referred to by the index.
Calls C++ function: QFlags<Qt::ItemFlag> QPersistentModelIndex::flags() const
.
Returns the flags for the item referred to by the index.
This function was introduced in Qt 4.2.
sourcepub unsafe fn is_valid(&self) -> bool
pub unsafe fn is_valid(&self) -> bool
Returns true
if this persistent model index is valid; otherwise returns false
.
Calls C++ function: bool QPersistentModelIndex::isValid() const
.
sourcepub unsafe fn model(&self) -> QPtr<QAbstractItemModel>
pub unsafe fn model(&self) -> QPtr<QAbstractItemModel>
Returns the model that the index belongs to.
Calls C++ function: const QAbstractItemModel* QPersistentModelIndex::model() const
.
Returns the model that the index belongs to.
sourcepub unsafe fn new_0a() -> CppBox<QPersistentModelIndex>
pub unsafe fn new_0a() -> CppBox<QPersistentModelIndex>
Calls C++ function: [constructor] void QPersistentModelIndex::QPersistentModelIndex()
.
sourcepub unsafe fn new_1a(
index: impl CastInto<Ref<QModelIndex>>
) -> CppBox<QPersistentModelIndex>
pub unsafe fn new_1a( index: impl CastInto<Ref<QModelIndex>> ) -> CppBox<QPersistentModelIndex>
Creates a new QPersistentModelIndex that is a copy of the model index.
Calls C++ function: [constructor] void QPersistentModelIndex::QPersistentModelIndex(const QModelIndex& index)
.
Creates a new QPersistentModelIndex that is a copy of the model index.
sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QPersistentModelIndex>>
) -> CppBox<QPersistentModelIndex>
pub unsafe fn new_copy( other: impl CastInto<Ref<QPersistentModelIndex>> ) -> CppBox<QPersistentModelIndex>
Creates a new QPersistentModelIndex that is a copy of the other persistent model index.
Calls C++ function: [constructor] void QPersistentModelIndex::QPersistentModelIndex(const QPersistentModelIndex& other)
.
Creates a new QPersistentModelIndex that is a copy of the other persistent model index.
sourcepub unsafe fn parent(&self) -> CppBox<QModelIndex>
pub unsafe fn parent(&self) -> CppBox<QModelIndex>
Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no parent.
Calls C++ function: QModelIndex QPersistentModelIndex::parent() const
.
Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no parent.
sourcepub unsafe fn row(&self) -> c_int
pub unsafe fn row(&self) -> c_int
Returns the row this persistent model index refers to.
Calls C++ function: int QPersistentModelIndex::row() const
.
Returns the row this persistent model index refers to.
sourcepub unsafe fn sibling(&self, row: c_int, column: c_int) -> CppBox<QModelIndex>
pub unsafe fn sibling(&self, row: c_int, column: c_int) -> CppBox<QModelIndex>
Returns the sibling at row and column or an invalid QModelIndex if there is no sibling at this position.
Calls C++ function: QModelIndex QPersistentModelIndex::sibling(int row, int column) const
.
Returns the sibling at row and column or an invalid QModelIndex if there is no sibling at this position.
See also parent().
sourcepub unsafe fn swap(&self, other: impl CastInto<Ref<QPersistentModelIndex>>)
pub unsafe fn swap(&self, other: impl CastInto<Ref<QPersistentModelIndex>>)
Swaps this persistent modelindex with other. This function is very fast and never fails.
Calls C++ function: void QPersistentModelIndex::swap(QPersistentModelIndex& other)
.
Swaps this persistent modelindex with other. This function is very fast and never fails.
This function was introduced in Qt 5.0.
sourcepub unsafe fn to_q_model_index(&self) -> Ref<QModelIndex>
pub unsafe fn to_q_model_index(&self) -> Ref<QModelIndex>
Calls C++ function: const QModelIndex& QPersistentModelIndex::operator const QModelIndex&() const
.
Trait Implementations§
source§impl CppDeletable for QPersistentModelIndex
impl CppDeletable for QPersistentModelIndex
source§impl Lt<Ref<QPersistentModelIndex>> for QPersistentModelIndex
impl Lt<Ref<QPersistentModelIndex>> for QPersistentModelIndex
source§unsafe fn lt(&self, other: &Ref<QPersistentModelIndex>) -> bool
unsafe fn lt(&self, other: &Ref<QPersistentModelIndex>) -> bool
Returns true
if this persistent model index is smaller than the other persistent model index; otherwise returns false
.
Calls C++ function: bool QPersistentModelIndex::operator<(const QPersistentModelIndex& other) const
.
Returns true
if this persistent model index is smaller than the other persistent model index; otherwise returns false
.
All values in the persistent model index are used when comparing with another persistent model index.
This function was introduced in Qt 4.1.
source§impl PartialEq<Ref<QModelIndex>> for QPersistentModelIndex
impl PartialEq<Ref<QModelIndex>> for QPersistentModelIndex
source§fn eq(&self, other: &Ref<QModelIndex>) -> bool
fn eq(&self, other: &Ref<QModelIndex>) -> bool
Returns true
if this persistent model index refers to the same location as the other model index; otherwise returns false
.
Calls C++ function: bool QPersistentModelIndex::operator==(const QModelIndex& other) const
.
Returns true
if this persistent model index refers to the same location as the other model index; otherwise returns false
.
All values in the persistent model index are used when comparing with another model index.
source§impl PartialEq<Ref<QPersistentModelIndex>> for QPersistentModelIndex
impl PartialEq<Ref<QPersistentModelIndex>> for QPersistentModelIndex
source§fn eq(&self, other: &Ref<QPersistentModelIndex>) -> bool
fn eq(&self, other: &Ref<QPersistentModelIndex>) -> bool
Returns true
if this persistent model index is equal to the other persistent model index; otherwise returns false
.
Calls C++ function: bool QPersistentModelIndex::operator==(const QPersistentModelIndex& other) const
.
Returns true
if this persistent model index is equal to the other persistent model index; otherwise returns false
.
All values in the persistent model index are used when comparing with another persistent model index.