Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QAbstractItemView Class Reference

The QAbstractItemView class provides the basic functionality for item view classes. More...

    #include <QAbstractItemView>

Inherits QViewport.

Inherited by QHeaderView, QListView, QTableView, and QTreeView.

- List of all members, including inherited members

### Public Types

- enum BeginEditAction { NeverEdit, CurrentChanged, DoubleClicked, SelectedClicked, EditKeyPressed, ..., AlwaysEdit }
- typedef BeginEditActions
- enum SelectionBehavior { SelectItems, SelectRows, SelectColumns }
- enum SelectionMode { Single, Multi, Extended, NoSelection }

### Writable Properties

- alternatingRowColors : bool
- autoScroll : bool
- beginEditActions : BeginEditActions
- evenRowColor : QColor

- keyTracking : bool
- keyboardInputInterval : int
- oddRowColor : QColor

- 2 writable properties inherited from QViewport
- 5 writable properties inherited from QFrame
- 33 writable properties inherited from QWidget
- 1 writable property inherited from QObject

### Read-Only Properties

- 1 read-only property inherited from QViewport
- 1 read-only property inherited from QFrame
- 24 read-only properties inherited from QWidget

### Public Functions

- QAbstractItemView ( QWidget * parent = 0 )
- ~QAbstractItemView ()
- void closePersistentEditor ( const QModelIndex & index )
- virtual int columnSizeHint ( int column ) const
- QModelIndex currentIndex () const
- virtual void ensureItemVisible ( const QModelIndex & index ) = 0
- virtual QModelIndex itemAt ( int x, int y ) const = 0
- QModelIndex itemAt ( const QPoint & p ) const
- QAbstractItemDelegate * itemDelegate () const
- QSize itemSizeHint ( const QModelIndex & index ) const
- virtual QRect itemViewportRect ( const QModelIndex & index ) const = 0
- virtual void keyboardSearch ( const QString & search )
- QAbstractItemModel * model () const
- void openPersistentEditor ( const QModelIndex & index )
- QModelIndex root () const
- virtual int rowSizeHint ( int row ) const
- int selectionBehavior () const
- int selectionMode () const
- QItemSelectionModel * selectionModel () const
- void setItemDelegate ( QAbstractItemDelegate * delegate )
- virtual void setModel ( QAbstractItemModel * model )
- void setSelectionBehavior ( int behavior )
- void setSelectionMode ( int mode )
- virtual void setSelectionModel ( QItemSelectionModel * selectionModel )

- 4 public functions inherited from QViewport
- 2 public functions inherited from QFrame
- 83 public functions inherited from QWidget
- 24 public functions inherited from QObject
- 2 public functions inherited from QPaintDevice

### Public Slots

- void clearSelection ()
- void edit ( const QModelIndex & index )
- virtual void reset ()
- virtual void selectAll ()
- void setCurrentIndex ( const QModelIndex & index )
- virtual void setRoot ( const QModelIndex & index )

- 16 public slots inherited from QWidget
- 1 public slot inherited from QObject

### Signals

- void aboutToShowContextMenu ( QMenu * menu, const QModelIndex & index )
- void clicked ( const QModelIndex & index, Qt::ButtonState button )
- void doubleClicked ( const QModelIndex & index, Qt::ButtonState button )
- void itemEntered ( const QModelIndex & index, Qt::ButtonState button )
- void keyPressed ( const QModelIndex & index, Qt::Key key, Qt::ButtonState state )
- void pressed ( const QModelIndex & index, Qt::ButtonState button )
- void returnPressed ( const QModelIndex & index )
- void rootChanged ( const QModelIndex & old, const QModelIndex & root )
- void viewportEntered ( Qt::ButtonState state )

- 1 signal inherited from QObject

### Static Public Members

- 4 static public members inherited from QWidget
- 4 static public members inherited from QObject

### Protected Types

- enum CursorAction { MoveUp, MoveDown, MoveLeft, MoveRight, MoveHome, ..., MovePageDown }
- enum State { NoState, DraggingState, SelectingState, EditingState, OpeningState, ClosingState }

### Protected Functions

- virtual void contextMenuEvent ( QContextMenuEvent * e )
- virtual void dragEnterEvent ( QDragEnterEvent * e )
- virtual void dragMoveEvent ( QDragMoveEvent * e )
- virtual QDragObject * dragObject ()
- virtual void dropEvent ( QDropEvent * e )
- virtual bool edit ( const QModelIndex & index, BeginEditAction action, QEvent * event )
- virtual void endEdit ( const QModelIndex & index, bool commit = true )
- virtual bool event ( QEvent * event )
- virtual void focusInEvent ( QFocusEvent * e )
- virtual void focusOutEvent ( QFocusEvent * e )
- int horizontalFactor () const
- virtual int horizontalOffset () const = 0
- virtual bool isDragEnabled ( const QModelIndex & index ) const
- virtual bool isIndexHidden ( const QModelIndex & index ) const = 0
- virtual void keyPressEvent ( QKeyEvent * e )
- virtual void mouseDoubleClickEvent ( QMouseEvent * e )
- virtual void mouseMoveEvent ( QMouseEvent * e )
- virtual void mousePressEvent ( QMouseEvent * e )
- virtual void mouseReleaseEvent ( QMouseEvent * e )
- virtual QModelIndex moveCursor ( QAbstractItemView::CursorAction cursorAction, Qt::ButtonState state ) = 0
- virtual void resizeEvent ( QResizeEvent * e )
- virtual QItemSelectionModel::SelectionFlags selectionCommand ( Qt::ButtonState state, const QModelIndex & index, QEvent::Type type = QEvent::None, Qt::Key key = Qt::Key_unknown ) const
- virtual QRect selectionViewportRect ( const QItemSelection & selection ) const = 0
- void setHorizontalFactor ( int factor )
- virtual void setSelection ( const QRect & rect, QItemSelectionModel::SelectionFlags flags ) = 0
- void setState ( State state )
- void setVerticalFactor ( int factor )
- virtual void startDrag ()
- State state () const
- virtual void timerEvent ( QTimerEvent * e )
- int verticalFactor () const
- virtual int verticalOffset () const = 0
- virtual QStyleOptionViewItem viewOptions () const

- 17 protected functions inherited from QViewport
- 44 protected functions inherited from QWidget
- 9 protected functions inherited from QObject

### Protected Slots

- virtual void commitData ( QWidget * editor )
- virtual void currentChanged ( const QModelIndex & current, const QModelIndex & previous )
- virtual void dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight )
- virtual void doneEditing ( QWidget * editor )
- virtual void editorDestroyed ( QObject * editor )
- virtual void rowsInserted ( const QModelIndex & parent, int start, int end )
- virtual void rowsRemoved ( const QModelIndex & parent, int start, int end )
- virtual void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected )

## Detailed Description

The QAbstractItemView class provides the basic functionality for item view classes.

QAbstractItemView class is the base class for every standard view that uses a QAbstractItemModel. QAbstractItemView is an abstract class and cannot itself be instantiated. It provides a standard interface for interoperating with models through the signals and slots mechanism, enabling subclasses to be kept up-to-date with changes to their models. This class provides standard support for keyboard and mouse navigation, viewport scrolling, item editing, and selections.

The view classes that inherit QAbstractItemView only need to implement their own view-specific functionality, such as drawing items, returning the geometry of items, finding items, etc.

QAbstractItemView provides common slots such as edit() and setCurrentIndex(), and common signals such as clicked(), doubleClicked(), returnPressed(), spacePressed(), and deletePressed(). Many protected slots are also provided, including dataChanged(), rowsInserted(), rowsRemoved(), columnsInserted(), columnsRemoved(), selectionChanged(), and currentChanged().

The root item is returned by root(), and the current item by currentIndex(). To make sure that an item is visible use ensureItemVisible().

Some of QAbstractItemView's functions are concerned with scrolling, for example setHorizontalFactor() and setVerticalFactor(). Several other functions are concerned with selection control; for example setSelectionMode(), and setSelectionBehavior(). This class provides a default selection model to work with (selectionModel()), but this can be replaced by using setSelectionModel() with an instance of QItemSelectionModel.

For complete control over the display and editing of items you can specify a delegate with setItemDelegate().

QAbstractItemView provides a lot of protected functions. Some are concerned with editing, for example, edit(), endEdit(), and currentEditor(), whilst others are keyboard and mouse event handlers.

See also Model/View Programming and QAbstractItemModel.

## Member Type Documentation

### enum QAbstractItemView::BeginEditAction
typedef QAbstractItemView::BeginEditActions

This enum describes actions which will initiate item editing.

`QAbstractItemView::NeverEdit` | No editing possible.
`QAbstractItemView::CurrentChanged` | Editing start whenever current item changes.
`QAbstractItemView::DoubleClicked` | Editing starts when an item is double clicked.
`QAbstractItemView::SelectedClicked` | Editing starts when clicking on an already selected item.
`QAbstractItemView::EditKeyPressed` | Editing starts when an edit key has been pressed over an item.
`QAbstractItemView::AnyKeyPressed` | Editing starts when any key is pressed over an item.
`QAbstractItemView::AlwaysEdit` | Editing starts for all above actions.

The BeginEditActions typedef can store a combination of BeginEditAction values.

### enum QAbstractItemView::CursorAction

This enum describes the different ways to navigate between items,

`QAbstractItemView::MoveUp` | Move to the item above the current.
`QAbstractItemView::MoveDown` | Move to the item below the current.
`QAbstractItemView::MoveLeft` | Move to the item left of the current.
`QAbstractItemView::MoveRight` | Move to the item right of the current.
`QAbstractItemView::MoveHome` | Move to the top-left corner item.
`QAbstractItemView::MoveEnd` | Move to the bottom-right corner item.
`QAbstractItemView::MovePageUp` | Move one page up above the current.
`QAbstractItemView::MovePageDown` | Move one page down below the current.

See also moveCursor().

### enum QAbstractItemView::SelectionBehavior

`QAbstractItemView::SelectItems` | Selecting single items.
`QAbstractItemView::SelectRows` | Selecting only rows.
`QAbstractItemView::SelectColumns` | Selecting only columns.

### enum QAbstractItemView::SelectionMode

This enum indicates how the view responds to user selections:

`QAbstractItemView::Single` | When the user selects an item, any already-selected item becomes unselected, and the user cannot unselect the selected item.
`QAbstractItemView::Multi` | When the user selects an item in the usual way, the selection status of that item is toggled and the other items are left alone.

`QAbstractItemView::Extended`

When the user selects an item in the usual way, the selection is cleared and the new item selected. However, if the user presses the Ctrl key when clicking on an item, the clicked item gets toggled and all other items are left untouched. And if the user presses the Shift key while clicking on an item, all items between the current item and the clicked item get selected or unselected, depending on the state of the clicked item. Also, multiple items can be selected by dragging the mouse over them.

`QAbstractItemView::NoSelection` | Items cannot be selected.

In other words, `Single` is a real single-selection list view, `Multi` a real multi-selection list view, `Extended` is a list view where users can select multiple items but usually want to select either just one or a range of contiguous items, and `NoSelection` is a list view where the user can look but not touch.

### enum QAbstractItemView::State

Describes the different states the view can be in. This is usually only interesting when reimplementing your own view.

`QAbstractItemView::NoState` | The is the default state.
`QAbstractItemView::DraggingState` | The user is dragging items.
`QAbstractItemView::SelectingState` | The user is selecting items.
`QAbstractItemView::EditingState` | The user is editing an item.
`QAbstractItemView::OpeningState` | The user is opening a branch of items.
`QAbstractItemView::ClosingState` | The user is closing a branch of items.

## Property Documentation

### alternatingRowColors : bool

This property holds whether to draw the background using alternating colors.

If this property is true, the item background will be drawn using alternating colors, otherwise the background will be drawn using the QPalette::Base color.

Access functions:

- bool alternatingRowColors () const
- void setAlternatingRowColors ( bool enable )

### autoScroll : bool

This property holds whether autoscrolling in drag move events is enabled.

If this property is set to true (the default), the QAbstractItemView automatically scrolls the contents of the view if the user drags within 16 pixels of the viewport edge. This only works if the viewport accepts drops. Autoscroll is switched off by setting this property to false.

Access functions:

- bool hasAutoScroll () const
- void setAutoScroll ( bool enable )

### beginEditActions : BeginEditActions

This property holds which actions will initiate item editing.

This property is a selection of flags defined by BeginEditAction, combined using the OR operator. The view will only initiate the editing of an item if the action performed is set in this property.

Access functions:

- BeginEditActions beginEditActions () const
- void setBeginEditActions ( BeginEditActions actions )

### evenRowColor : QColor

This property holds the color used to draw the background for even rows.

Access functions:

- QColor evenRowColor () const
- void setEvenRowColor ( const QColor & even )

### keyTracking : bool

This property holds whether the view emits a signal for every key press.

Access functions:

- bool hasKeyTracking () const
- void setKeyTracking ( bool enable )

### keyboardInputInterval : int

This property holds the interval threshold for doing keyboard searches.

Access functions:

- int keyboardInputInterval () const
- void setKeyboardInputInterval ( int msec )

### oddRowColor : QColor

This property holds the color used to draw the background for odd rows.

Access functions:

- QColor oddRowColor () const
- void setOddRowColor ( const QColor & odd )

## Member Function Documentation

### QAbstractItemView::QAbstractItemView ( QWidget * parent = 0 )

Constructs an abstract item view with the given parent.

### QAbstractItemView::~QAbstractItemView ()

Destroys the view.

### void QAbstractItemView::aboutToShowContextMenu ( QMenu * menu, const QModelIndex & index ) `[signal]`

This signal is emitted when the context menu is invoked. The menu is an empty menu; if you populate it with actions it will be popped up for the user. The current item when the contex menu event occurred is specified by index.

### void QAbstractItemView::clearSelection () `[slot]`

Clears all selected items.

### void QAbstractItemView::clicked ( const QModelIndex & index, Qt::ButtonState button ) `[signal]`

This signal is emitted when a mouse button is clicked. The button is specified by button (see Qt::ButtonState), and the item the mouse was clicked on is specified by index (which may be invalid if the mouse was not clicked on an item).

### void QAbstractItemView::closePersistentEditor ( const QModelIndex & index )

Closes the persistent editor for the item at the given index.

### int QAbstractItemView::columnSizeHint ( int column ) const `[virtual]`

Returns the width size hint for the specified column.

### void QAbstractItemView::commitData ( QWidget * editor ) `[virtual protected slot]`

Commit the data in the editor to the model.

See also doneEditing().

### void QAbstractItemView::contextMenuEvent ( QContextMenuEvent * e ) `[virtual protected]`

This function is called when context menu event e occurs. It emits the aboutToShowContextMenu() signal with a pointer to a QMenu object; if this QMenu object is populated with actions (e.g. in a slot you've connected to the aboutToShowContextMenu() signal), then the menu is shown.

Reimplemented from QWidget.

### void QAbstractItemView::currentChanged ( const QModelIndex & current, const QModelIndex & previous ) `[virtual protected slot]`

This slot is called when a new item becomes the current item. The previous current item is specified by the previous index, and the new item by the current index.

If you want to know about changes to items see the dataChanged() signal.

### QModelIndex QAbstractItemView::currentIndex () const

Returns the model index of the current item.

See also setCurrentIndex().

### void QAbstractItemView::dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ) `[virtual protected slot]`

This slot is called when items are changed in the model. The changed items are those from topLeft to bottomRight inclusive. If just one item is changed topLeft == bottomRight.

### void QAbstractItemView::doneEditing ( QWidget * editor ) `[virtual protected slot]`

Releases the editor editor from the view without commiting the editors data.

See also endEdit().

### void QAbstractItemView::doubleClicked ( const QModelIndex & index, Qt::ButtonState button ) `[signal]`

This signal is emitted when a mouse button is double-clicked. The button is specified by button (see Qt::ButtonState), and the item the mouse was double-clicked on is specified by index (which may be invalid if the mouse was not double-clicked on an item).

### void QAbstractItemView::dragEnterEvent ( QDragEnterEvent * e ) `[virtual protected]`

This function is called when drag enter event e occurs. If the drag is over a valid dropping place (e.g. over an item that accepts drops), the event is accepted.

Reimplemented from QWidget.

See also dropEvent() and startDrag().

### void QAbstractItemView::dragMoveEvent ( QDragMoveEvent * e ) `[virtual protected]`

This function is called when drag move event e occurs. It can cause the view to scroll, for example if the user drags a selection to view's right or bottom edge.

Reimplemented from QWidget.

See also dropEvent() and startDrag().

### QDragObject * QAbstractItemView::dragObject () `[virtual protected]`

Returns a new drag object that contains the model indexes of all the model's selected items.

See also startDrag().

### void QAbstractItemView::dropEvent ( QDropEvent * e ) `[virtual protected]`

This function is called when drop event e occurs. If there's a valid item under the mouse pointer when the drop occurs, the drop is accepted.

Reimplemented from QWidget.

See also startDrag().

### void QAbstractItemView::edit ( const QModelIndex & index ) `[slot]`

Starts editing the item item at index if it is editable.

### bool QAbstractItemView::edit ( const QModelIndex & index, BeginEditAction action, QEvent * event ) `[virtual protected]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Starts editing the item at index, creating an editor if necessary, and returns true if the view's State is now `EditingState`; otherwise returns false. The action that initiated the editing is specified by action, and the event that was behind this is specified by event.

See also endEdit().

### void QAbstractItemView::editorDestroyed ( QObject * editor ) `[virtual protected slot]`

Remove the editor editor from the map.

### void QAbstractItemView::endEdit ( const QModelIndex & index, bool commit = true ) `[virtual protected]`

Ends the editing operation on the item represented by the given index. If commit is true, the model item is updated with the value held by the editor; otherwise the editor's value is ignored. In both cases, if there was an editor widget it is released.

See also edit() and QAbstractItemDelegate::releaseEditor().

### void QAbstractItemView::ensureItemVisible ( const QModelIndex & index ) `[pure virtual]`

Scrolls the view if necessary to ensure that the item at index is visible.

In the base class this is a pure virtual function.

### bool QAbstractItemView::event ( QEvent * event ) `[virtual protected]`

This function is used to handle tool tips, status tips, and What's This? mode, if the given event is a QEvent::ToolTip, a QEvent::WhatsThis, or a QEvent::StatusTip. It passes all other events on to its base class event() handler.

Reimplemented from QObject.

### void QAbstractItemView::focusInEvent ( QFocusEvent * e ) `[virtual protected]`

This function is called when focus event e occurs and is a focus in event.

Reimplemented from QWidget.

### void QAbstractItemView::focusOutEvent ( QFocusEvent * e ) `[virtual protected]`

This function is called when focus event e occurs and is a focus out event.

Reimplemented from QWidget.

### int QAbstractItemView::horizontalFactor () const `[protected]`

Returns the horizontal scrollbar's stepping factor.

See also setHorizontalFactor() and verticalFactor().

### int QAbstractItemView::horizontalOffset () const `[pure virtual protected]`

Returns the horizontal offset of the view.

In the base class this is a pure virtual function.

### bool QAbstractItemView::isDragEnabled ( const QModelIndex & index ) const `[virtual protected]`

Returns true if the item view allows the item at position index to be dragged; otherwise returns false.

### bool QAbstractItemView::isIndexHidden ( const QModelIndex & index ) const `[pure virtual protected]`

Returns true if the item refered to by the given index is hidden, otherwise returns false.

In the base class this is a pure virtual function.

### QModelIndex QAbstractItemView::itemAt ( int x, int y ) const `[pure virtual]`

Returns the model index of the item at point (x, y).

In the base class this is a pure virtual function.

### QModelIndex QAbstractItemView::itemAt ( const QPoint & p ) const

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the model index of the item at point p.

In the base class this is built on the other itemAt() function, which is pure virtual.

### QAbstractItemDelegate * QAbstractItemView::itemDelegate () const

Returns the item delegate used by this view and model. This is either one set with setItemDelegate(), or the default one.

See also setItemDelegate().

### void QAbstractItemView::itemEntered ( const QModelIndex & index, Qt::ButtonState button ) `[signal]`

This signal is emitted when the mouse cursor enters the item specified by index. The button state is specified by button (see Qt::ButtonState).

### QSize QAbstractItemView::itemSizeHint ( const QModelIndex & index ) const

Returns the size hint for the item with the specified index.

### QRect QAbstractItemView::itemViewportRect ( const QModelIndex & index ) const `[pure virtual]`

Returns the rectangle on the viewport occupied by the item at index.

In the base class this is a pure virtual function.

### void QAbstractItemView::keyPressEvent ( QKeyEvent * e ) `[virtual protected]`

This function is called when a key event e occurs. It handles basic cursor movement, e.g. Up, Down, Left, Right, Home, PageUp, and PageDown, and emits the returnPressed(), spacePressed(), and deletePressed() signals is the associated key is pressed. This function is where editing is initiated by key press, e.g. if F2 is pressed.

Reimplemented from QWidget.

See also edit().

### void QAbstractItemView::keyPressed ( const QModelIndex & index, Qt::Key key, Qt::ButtonState state ) `[signal]`

This signal is emitted if keyTracking is enabled and a key is pressed in the view. The item index is the current item when the key key was pressed, and state is the button state at the keypress (see Qt::ButtonState).

### void QAbstractItemView::keyboardSearch ( const QString & search ) `[virtual]`

Moves to and selects the item best matching the string search. If no item is found nothing happens.

### QAbstractItemModel * QAbstractItemView::model () const

Returns the model that this view is presenting.

### void QAbstractItemView::mouseDoubleClickEvent ( QMouseEvent * e ) `[virtual protected]`

This function is called when a mouse double-click event e occurs. If the double-click is on a valid item it emits the doubleClicked() signal and calls edit() on the item.

Reimplemented from QWidget.

### void QAbstractItemView::mouseMoveEvent ( QMouseEvent * e ) `[virtual protected]`

This function is called when a mouse move event e occurs. If a selection is in progress and new items are moved over the selection is extended; if a drag is in progress it is continued.

Reimplemented from QWidget.

### void QAbstractItemView::mousePressEvent ( QMouseEvent * e ) `[virtual protected]`

This function is called when a mouse event e occurs. If a valid item is pressed on it is made into the current item. This function emits the pressed() signal.

Reimplemented from QWidget.

### void QAbstractItemView::mouseReleaseEvent ( QMouseEvent * e ) `[virtual protected]`

This function is called when a mouse release event e occurs. It will emit the clicked() signal if an item was being pressed and will send a context menu event if it is a right-mouse button release.

Reimplemented from QWidget.

See also contextMenuEvent().

### QModelIndex QAbstractItemView::moveCursor ( QAbstractItemView::CursorAction cursorAction, Qt::ButtonState state ) `[pure virtual protected]`

Moves the cursor in the view in accordance with the given cursorAction and button state.

### void QAbstractItemView::openPersistentEditor ( const QModelIndex & index )

Opens a persistent editor on the item at the given index. If no editor exists, the delegate will create a new editor.

### void QAbstractItemView::pressed ( const QModelIndex & index, Qt::ButtonState button ) `[signal]`

This signal is emitted when a mouse button is pressed. The button is specified by button (see Qt::ButtonState), and the item the mouse was pressed on is specified by index (which may be invalid if the mouse was not pressed on an item).

### void QAbstractItemView::reset () `[virtual slot]`

Reset the internal state of the view.

### void QAbstractItemView::resizeEvent ( QResizeEvent * e ) `[virtual protected]`

This function is called when a resize event e occurs.

Reimplemented from QWidget.

### void QAbstractItemView::returnPressed ( const QModelIndex & index ) `[signal]`

This signal is emitted when Return (or Enter) is pressed. The item to be acted on by the key press is specified by index.

### QModelIndex QAbstractItemView::root () const

Returns the model index of the model's root item. The root item is the parent item to the views toplevel items. The root can be invalid.

See also setRoot().

### void QAbstractItemView::rootChanged ( const QModelIndex & old, const QModelIndex & root ) `[signal]`

This signal is emitted when the model's root index changes. The previous index is specified by old, and the new root index is specified by root.

### int QAbstractItemView::rowSizeHint ( int row ) const `[virtual]`

Returns the height size hint for the specified row.

### void QAbstractItemView::rowsInserted ( const QModelIndex & parent, int start, int end ) `[virtual protected slot]`

This slot is called when rows are inserted. The new rows are those under the given parent from start to end inclusive. The base class implementation calls fetchMore() on the model to check for more data.

See also rowsRemoved().

### void QAbstractItemView::rowsRemoved ( const QModelIndex & parent, int start, int end ) `[virtual protected slot]`

This slot is called when rows are removed. The deleted rows are those under the given parent from start to end inclusive. The base class implementation does nothing.

See also rowsInserted().

### void QAbstractItemView::selectAll () `[virtual slot]`

Selects all non-hidden items.

### int QAbstractItemView::selectionBehavior () const

Returns the SelectionBehavior flags.

See also setSelectionBehavior() and SelectionMode.

### void QAbstractItemView::selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected ) `[virtual protected slot]`

This slot is called when the selection is changed. The previous selection (which may be empty), is specified by deselected, and the new selection by selected.

### QItemSelectionModel::SelectionFlags QAbstractItemView::selectionCommand ( Qt::ButtonState state, const QModelIndex & index, QEvent::Type type = QEvent::None, Qt::Key key = Qt::Key_unknown ) const `[virtual protected]`

Returns the SelectionFlags to be used when updating selections. Reimplement this function to add your own selection behavior.

This function is called on user input events like mouse and keyboard events; the mouse button state is specified by state, the index of the relevant item by index, the even type by type, and the key (if a key was pressed) by key.

### int QAbstractItemView::selectionMode () const

Returns the SelectionMode flags.

See also setSelectionMode() and SelectionBehavior.

### QItemSelectionModel * QAbstractItemView::selectionModel () const

Returns the current selection.

See also setSelectionModel() and clearSelection().

### QRect QAbstractItemView::selectionViewportRect ( const QItemSelection & selection ) const `[pure virtual protected]`

Returns the rectangle from the viewport of the items in the given selection.

### void QAbstractItemView::setCurrentIndex ( const QModelIndex & index ) `[slot]`

Sets the current item to be the item at index. Note: Selections stays unmodified.

See also currentIndex().

### void QAbstractItemView::setHorizontalFactor ( int factor ) `[protected]`

Sets the horizontal scrollbar's stepping factor to factor.

See also horizontalFactor() and setVerticalFactor().

### void QAbstractItemView::setItemDelegate ( QAbstractItemDelegate * delegate )

Sets the item delegate for this view and its model to delegate. This is useful if you want complete control over the editing and display of items.

See also itemDelegate().

### void QAbstractItemView::setModel ( QAbstractItemModel * model ) `[virtual]`

Sets the model for the view to present.

### void QAbstractItemView::setRoot ( const QModelIndex & index ) `[virtual slot]`

Sets the root item to the item at index.

See also root().

### void QAbstractItemView::setSelection ( const QRect & rect, QItemSelectionModel::SelectionFlags flags ) `[pure virtual protected]`

Applies the selection flags to the items in or touched by the rectangle, rect.

See also selectionCommand().

### void QAbstractItemView::setSelectionBehavior ( int behavior )

Sets the SelectionBehavior flags to behavior.

See also selectionBehavior() and SelectionMode.

### void QAbstractItemView::setSelectionMode ( int mode )

Sets the SelectionMode flags to mode.

See also selectionMode() and SelectionBehavior.

### void QAbstractItemView::setSelectionModel ( QItemSelectionModel * selectionModel ) `[virtual]`

Sets the current selection to the given selectionModel.

See also selectionModel() and clearSelection().

### void QAbstractItemView::setState ( State state ) `[protected]`

Sets the item view's state to the given state

See also state().

### void QAbstractItemView::setVerticalFactor ( int factor ) `[protected]`

Sets the vertical scrollbar's stepping factor.

See also verticalFactor() and setHorizontalFactor().

### void QAbstractItemView::startDrag () `[virtual protected]`

Starts a drag by calling drag() on a new dragObject().

### State QAbstractItemView::state () const `[protected]`

Returns the item view's state.

See also setState().

### void QAbstractItemView::timerEvent ( QTimerEvent * e ) `[virtual protected]`

This function is called when a timer event e occurs.

Reimplemented from QObject.

### int QAbstractItemView::verticalFactor () const `[protected]`

Returns the vertical scrollbar's stepping factor.

See also setVerticalFactor() and horizontalFactor().

### int QAbstractItemView::verticalOffset () const `[pure virtual protected]`

Returns the vertical offset of the view.

In the base class this is a pure virtual function.

### QStyleOptionViewItem QAbstractItemView::viewOptions () const `[virtual protected]`

Returns QStyleOptionViewItem structure populated with the view's palette, font, state, alignments etc.

### void QAbstractItemView::viewportEntered ( Qt::ButtonState state ) `[signal]`

This signal is emitted when the mouse cursor enters the viewport. The button state is specified by state (see Qt::ButtonState).