Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions | ![]() |
The QItemSelection class manages information about selected items in a model. More...
#include <QItemSelection>
Inherits QList<QItemSelectionRange>.
The QItemSelection class manages information about selected items in a model.
A QItemSelection describes the items in a model that have been selected by the user. It provides functions for creating and manipulating selections, and selecting a range of items from a model.
An item selection can be constructed and initialized to contain a range of items from an existing model. The following example constructs a selection that contains a range of items from the given model, beginning at the topLeft, and ending at the bottomRight.
QItemSelection *selection = new QItemSelection(topLeft, bottomRight, model);
An empty item selection can be constructed, and later populated as required. So, if the model is going to be unavailable when we construct the item selection, we can rewrite the above code in the following way:
QItemSelection *selection = new QItemSelection(); ... selection->select(topLeft, bottomRight, model);
QItemSelection saves memory, and avoids unnecessary work, by working with selection ranges rather than recording the model item index for each item in the selection. Generally, an instance of this class will contain a list of non-overlapping selection ranges.
Use merge() to merge two item selections, split() to that include merging (), splitting (split()) (select())
See also Model/View Programming and QItemSelectionModel.
Constructs an empty selection.
Constructs an item selection for the model that extends from the top-left model item, specified by the topLeft index, to the bottom-right item, specified by bottomRight.
Returns true if the model contains the specified index; otherwise returns false.
Returns the list of selected model index items for the given model.
Merges the other selection with this QItemSelection using the command given. This method guarantees that no ranges are overlapping.
Note that only QItemSelectionModel::Select, QItemSelectionModel::Deselect, and QItemSelectionModel::Toggle are supported.
See also split().
Selects the range in the model that extends from the top-left model item, specified by the topLeft index, to the bottom-right item, specified by bottomRight.
Splits the selection range using the selection other range, and puts the resulting selection in result.
See also merge().
Copyright © 2004 Trolltech. | Trademarks | Qt 4.0.0-tp1 |