QItemSelectionRange Class Reference

[ QtGui module]

The QItemSelectionRange class manages information about a range of selected items in a model. 更多...

方法

Special Methods


详细描述

The QItemSelectionRange class manages information about a range of selected items in a model.

A QItemSelectionRange contains information about a range of selected items in a model. A range of items is a contiguous array of model items, extending to cover a number of adjacent rows and columns with a common parent item; this can be visualized as a two-dimensional block of cells in a table. A selection range has a top (), left () a bottom (), right () and a parent ().

The QItemSelectionRange class is one of the 模型/视图类 且属于 Qt 的 模型/视图框架 .

The model items contained in the selection range can be obtained 使用 indexes () function. Use QItemSelectionModel.selectedIndexes () to get a list of all selected items for a view.

You can determine whether a given model item lies within a particular range by using the contains () function. Ranges can also be compared using the overloaded operators for equality and inequality, and the intersects () function allows you to determine whether two ranges overlap.


方法文档编制

QItemSelectionRange.__init__ ( self )

Constructs an empty selection range.

QItemSelectionRange.__init__ ( self , QItemSelectionRange   other )

Copy constructor. Constructs a new selection range with the same contents as the other range given.

QItemSelectionRange.__init__ ( self , QModelIndex   atopLeft , QModelIndex   abottomRight )

Constructs a new selection range containing only the index specified by the topLeft and the index bottomRight .

QItemSelectionRange.__init__ ( self , QModelIndex   index )

Constructs a new selection range containing only the model item specified by the model index index .

int QItemSelectionRange.bottom ( self )

Returns the row index corresponding to the lowermost selected row in the selection range.

QModelIndex QItemSelectionRange.bottomRight ( self )

Returns the index for the item located at the bottom-right corner of the selection range.

另请参阅 bottom (), right (),和 topLeft ().

bool QItemSelectionRange.contains ( self , QModelIndex   index )

Returns true if the model item specified by the index lies within the range of selected items; otherwise returns false.

bool QItemSelectionRange.contains ( self , int  row , int  column , QModelIndex   parentIndex )

这是重载函数。

Returns true if the model item specified by ( row , column ) and with parentIndex as the parent item lies within the range of selected items; otherwise returns false.

int QItemSelectionRange.height ( self )

Returns the number of selected rows in the selection range.

list-of-QModelIndex QItemSelectionRange.indexes ( self )

Returns the list of model index items stored in the selection.

QItemSelectionRange QItemSelectionRange.intersect ( self , QItemSelectionRange   other )

QItemSelectionRange QItemSelectionRange.intersected ( self , QItemSelectionRange   other )

Returns a new selection range containing only the items that are found in both the selection range and the other selection range.

该函数在 Qt 4.2 引入。

bool QItemSelectionRange.intersects ( self , QItemSelectionRange   other )

Returns true if this selection range intersects (overlaps with) the other range given; otherwise returns false.

bool QItemSelectionRange.isEmpty ( self )

Returns true if the selection range contains no selectable item

该函数在 Qt 4.7 引入。

bool QItemSelectionRange.isValid ( self )

Returns true if the selection range is valid; otherwise returns false.

int QItemSelectionRange.left ( self )

Returns the column index corresponding to the leftmost selected column in the selection range.

QAbstractItemModel QItemSelectionRange.model ( self )

Returns the model that the items in the selection range belong to.

QModelIndex QItemSelectionRange.parent ( self )

Returns the parent model item index of the items in the selection range.

int QItemSelectionRange.right ( self )

Returns the column index corresponding to the rightmost selected column in the selection range.

int QItemSelectionRange.top ( self )

Returns the row index corresponding to the uppermost selected row in the selection range.

QModelIndex QItemSelectionRange.topLeft ( self )

Returns the index for the item located at the top-left corner of the selection range.

另请参阅 top (), left (),和 bottomRight ().

int QItemSelectionRange.width ( self )

Returns the number of selected columns in the selection range.

bool QItemSelectionRange.__eq__ ( self , QItemSelectionRange   other )

bool QItemSelectionRange.__ge__ ( self , QItemSelectionRange   other )

int QItemSelectionRange.__hash__ ( self )

bool QItemSelectionRange.__lt__ ( self , QItemSelectionRange   other )

bool QItemSelectionRange.__ne__ ( self , QItemSelectionRange   other )