|  | Home · All Classes · Modules

# QColumnView Class Reference
[QtGui module]

The QColumnView class provides a model/view implementation of a column view. More...

Inherits QAbstractItemView.

### Methods

- __init__ (self, QWidget parent = None)
- QList<int>list-of-int columnWidths (self)
- QAbstractItemView createColumn (self, QModelIndex)
- currentChanged (self, QModelIndex, QModelIndex)
- int horizontalOffset (self)
- QModelIndex indexAt (self, QPoint)
- initializeColumn (self, QAbstractItemView)
- bool isIndexHidden (self, QModelIndex)
- QModelIndex moveCursor (self, QAbstractItemView.CursorAction, Qt.KeyboardModifiers)
- QWidget previewWidget (self)
- resizeEvent (self, QResizeEvent)
- bool resizeGripsVisible (self)
- rowsInserted (self, QModelIndex, int, int)
- scrollContentsBy (self, int, int)
- scrollTo (self, QModelIndex, QAbstractItemView.ScrollHint hint = QAbstractItemView.EnsureVisible)
- selectAll (self)
- setColumnWidths (self, QList<int>list-of-int)
- setModel (self, QAbstractItemModel)
- setPreviewWidget (self, QWidget)
- setResizeGripsVisible (self, bool)
- setRootIndex (self, QModelIndex)
- setSelection (self, QRect, QItemSelectionModel.SelectionFlags)
- setSelectionModel (self, QItemSelectionModel)
- QSize sizeHint (self)
- int verticalOffset (self)
- QRect visualRect (self, QModelIndex)
- QRegion visualRegionForSelection (self, QItemSelection)

### Qt Signals

- void updatePreviewWidget (const QModelIndex&)

## Detailed Description

The QColumnView class provides a model/view implementation of a column view.

QColumnView displays a model in a number of QListViews, one for each hierarchy in the tree. This is sometimes referred to as a cascading list.

The QColumnView class is one of the Model/View Classes and is part of Qt's model/view framework.

QColumnView implements the interfaces defined by the QAbstractItemView class to allow it to display data provided by models derived from the QAbstractItemModel class.

See also Model/View Programming.

## Method Documentation

### QColumnView.__init__ (self, QWidget parent = None)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a column view with a parent to represent a model's data. Use setModel() to set the model.

See also QAbstractItemModel.

### QList<int>list-of-int QColumnView.columnWidths (self)

Returns a list of the width of all the columns in this view.

See also setColumnWidths().

### QAbstractItemView QColumnView.createColumn (self, QModelIndex)

To use a custom widget for the final column when you select an item overload this function and return a widget. index is the root index that will be assigned to the view.

Return the new view. QColumnView will automatically take ownership of the widget.

See also setPreviewWidget().

### QColumnView.currentChanged (self, QModelIndex, QModelIndex)

This method is also a Qt slot with the C++ signature `void currentChanged(const QModelIndex&,const QModelIndex&)`.

Reimplemented from QAbstractItemView.currentChanged().

### int QColumnView.horizontalOffset (self)

Reimplemented from QAbstractItemView.horizontalOffset().

### QModelIndex QColumnView.indexAt (self, QPoint)

Reimplemented from QAbstractItemView.indexAt().

### QColumnView.initializeColumn (self, QAbstractItemView)

Copies the behavior and options of the column view and applies them to the column such as the iconSize(), textElideMode() and alternatingRowColors(). This can be useful when reimplementing createColumn().

This function was introduced in Qt 4.4.

See also createColumn().

### bool QColumnView.isIndexHidden (self, QModelIndex)

Reimplemented from QAbstractItemView.isIndexHidden().

### QModelIndex QColumnView.moveCursor (self, QAbstractItemView.CursorAction, Qt.KeyboardModifiers)

Reimplemented from QAbstractItemView.moveCursor().

Move left should go to the parent index Move right should go to the child index or down if there is no child

### QWidget QColumnView.previewWidget (self)

Returns the preview widget, or 0 if there is none.

See also setPreviewWidget() and updatePreviewWidget().

### QColumnView.resizeEvent (self, QResizeEvent)

Reimplemented from QWidget.resizeEvent().

### bool QColumnView.resizeGripsVisible (self)

### QColumnView.rowsInserted (self, QModelIndex, int, int)

Reimplemented from QAbstractItemView.rowsInserted().

### QColumnView.scrollContentsBy (self, int, int)

Reimplemented from QAbstractScrollArea.scrollContentsBy().

### QColumnView.scrollTo (self, QModelIndex, QAbstractItemView.ScrollHint hint = QAbstractItemView.EnsureVisible)

Reimplemented from QAbstractItemView.scrollTo().

### QColumnView.selectAll (self)

Reimplemented from QAbstractItemView.selectAll().

### QColumnView.setColumnWidths (self, QList<int>list-of-int)

Sets the column widths to the values given in the list. Extra values in the list are kept and used when the columns are created.

If list contains too few values, only width of the rest of the columns will not be modified.

See also columnWidths() and createColumn().

### QColumnView.setModel (self, QAbstractItemModel)

Reimplemented from QAbstractItemView.setModel().

### QColumnView.setPreviewWidget (self, QWidget)

The QWidget argument has it's ownership transferred to Qt.

Sets the preview widget.

The widget becomes a child of the column view, and will be destroyed when the column area is deleted or when a new widget is set.

See also previewWidget() and updatePreviewWidget().

### QColumnView.setResizeGripsVisible (self, bool)

### QColumnView.setRootIndex (self, QModelIndex)

Reimplemented from QAbstractItemView.setRootIndex().

### QColumnView.setSelection (self, QRect, QItemSelectionModel.SelectionFlags)

Reimplemented from QAbstractItemView.setSelection().

### QColumnView.setSelectionModel (self, QItemSelectionModel)

Reimplemented from QAbstractItemView.setSelectionModel().

### QSize QColumnView.sizeHint (self)

Reimplemented from QWidget.sizeHint().

### int QColumnView.verticalOffset (self)

Reimplemented from QAbstractItemView.verticalOffset().

### QRect QColumnView.visualRect (self, QModelIndex)

Reimplemented from QAbstractItemView.visualRect().

### QRegion QColumnView.visualRegionForSelection (self, QItemSelection)

Reimplemented from QAbstractItemView.visualRegionForSelection().

## Qt Signal Documentation

### void updatePreviewWidget (const QModelIndex&)

This is the default overload of this signal.

This signal is emitted when the preview widget should be updated to provide rich information about index

See also previewWidget().