Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QPersistentModelIndex Class

TheQPersistentModelIndex class is used to locate data in a data model.More...

Header:#include <QPersistentModelIndex>

Public Functions

QPersistentModelIndex(const QModelIndex & index)
QPersistentModelIndex(const QPersistentModelIndex & other)
QModelIndexchild(int row, int column) const
intcolumn() const
QVariantdata(int role = Qt::DisplayRole) const
Qt::ItemFlagsflags() const
boolisValid() const
const QAbstractItemModel *model() const
QModelIndexparent() const
introw() const
QModelIndexsibling(int row, int column) const
operator const QModelIndex &() const
booloperator!=(const QPersistentModelIndex & other) const
booloperator!=(const QModelIndex & other) const
booloperator<(const QPersistentModelIndex & other) const
QPersistentModelIndex &operator=(const QPersistentModelIndex & other)
QPersistentModelIndex &operator=(const QModelIndex & other)
booloperator==(const QPersistentModelIndex & other) const
booloperator==(const QModelIndex & other) const

Detailed Description

TheQPersistentModelIndex class is used to locate data in a data model.

AQPersistentModelIndex is a model index that can be stored by an application, and later used to access information in a model. Unlike theQModelIndex class, it is safe to store aQPersistentModelIndex 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.

See alsoModel/View Programming,QModelIndex, andQAbstractItemModel.

Member Function Documentation

QPersistentModelIndex::QPersistentModelIndex(constQModelIndex & index)

Creates a newQPersistentModelIndex that is a copy of the modelindex.

QPersistentModelIndex::QPersistentModelIndex(constQPersistentModelIndex & other)

Creates a newQPersistentModelIndex that is a copy of theother persistent model index.

QModelIndex QPersistentModelIndex::child(int row,int column) const

Returns the child of the model index that is stored in the givenrow andcolumn.

See alsoparent() andsibling().

int QPersistentModelIndex::column() const

Returns the column this persistent model index refers to.

QVariant QPersistentModelIndex::data(int role = Qt::DisplayRole) const

Returns the data for the givenrole for the item referred to by the index.

See alsoQt::ItemDataRole andQAbstractItemModel::setData().

Qt::ItemFlags QPersistentModelIndex::flags() const

Returns the flags for the item referred to by the index.

This function was introduced in Qt 4.2.

bool QPersistentModelIndex::isValid() const

Returns true if this persistent model index is valid; otherwise returns false.

A valid index belongs to a model, and has non-negative row and column numbers.

See alsomodel(),row(), andcolumn().

constQAbstractItemModel * QPersistentModelIndex::model() const

Returns the model that the index belongs to.

QModelIndex QPersistentModelIndex::parent() const

Returns the parentQModelIndex for this persistent index, or an invalidQModelIndex if it has no parent.

See alsochild(),sibling(), andmodel().

int QPersistentModelIndex::row() const

Returns the row this persistent model index refers to.

QModelIndex QPersistentModelIndex::sibling(int row,int column) const

Returns the sibling atrow andcolumn or an invalidQModelIndex if there is no sibling at this position.

See alsoparent() andchild().

QPersistentModelIndex::operator const QModelIndex &() const

Cast operator that returns a constQModelIndex&.

bool QPersistentModelIndex::operator!=(constQPersistentModelIndex & other) const

Returns true if this persistent model index is not equal to theother persistent model index; otherwise returns false.

This function was introduced in Qt 4.2.

bool QPersistentModelIndex::operator!=(constQModelIndex & other) const

Returns true if this persistent model index does not refer to the same location as theother model index; otherwise returns false.

bool QPersistentModelIndex::operator<(constQPersistentModelIndex & other) const

Returns true if this persistent model index is smaller than theother 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.

QPersistentModelIndex & QPersistentModelIndex::operator=(constQPersistentModelIndex & other)

Sets the persistent model index to refer to the same item in a model as theother persistent model index.

QPersistentModelIndex & QPersistentModelIndex::operator=(constQModelIndex & other)

Sets the persistent model index to refer to the same item in a model as theother model index.

bool QPersistentModelIndex::operator==(constQPersistentModelIndex & other) const

Returns true if this persistent model index is equal to theother persistent model index; otherwise returns false.

All values in the persistent model index are used when comparing with another persistent model index.

bool QPersistentModelIndex::operator==(constQModelIndex & other) const

Returns true if this persistent model index refers to the same location as theother model index; otherwise returns false.

All values in the persistent model index are used when comparing with another model index.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp