QColumnView Class

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

头文件: #include <QColumnView>
qmake: QT += widgets
开始支持版本: Qt 4.3
基类: QAbstractItemView

属性

公有函数

QColumnView(QWidget *parent = Q_NULLPTR)
~QColumnView()
QList<int> columnWidths() const
QWidget *previewWidget() const
bool resizeGripsVisible() const
void setColumnWidths(const QList<int> &list)
void setPreviewWidget(QWidget *widget)
void setResizeGripsVisible(bool visible)

重新实现的公有函数

virtual QModelIndex indexAt(const QPoint &point) const
virtual void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible)
virtual void selectAll()
virtual void setModel(QAbstractItemModel *model)
virtual void setRootIndex(const QModelIndex &index)
virtual void setSelectionModel(QItemSelectionModel *newSelectionModel)
virtual QSize sizeHint() const
virtual QRect visualRect(const QModelIndex &index) const

信号

void updatePreviewWidget(const QModelIndex &index)

受保护的函数

virtual QAbstractItemView *createColumn(const QModelIndex &index)
void initializeColumn(QAbstractItemView *column) const

重新实现的受保护函数

virtual void currentChanged(const QModelIndex &current, const QModelIndex &previous)
virtual int horizontalOffset() const
virtual bool isIndexHidden(const QModelIndex &index) const
virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)
virtual void resizeEvent(QResizeEvent *event)
virtual void rowsInserted(const QModelIndex &parent, int start, int end)
virtual void scrollContentsBy(int dx, int dy)
virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command)
virtual int verticalOffset() const
virtual QRegion visualRegionForSelection(const QItemSelection &selection) const

其他继承的成员

详细描述

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.

参见 Model/View Programming.

属性

resizeGripsVisible : bool

This property holds the way to specify if the list views gets resize grips or not

By default, visible is set to true

访问函数:

bool resizeGripsVisible() const
void setResizeGripsVisible(bool visible)

参见 setRootIndex().

成员函数

QColumnView::QColumnView(QWidget *parent = Q_NULLPTR)

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

参见 QAbstractItemModel.

QColumnView::~QColumnView()

Destroys the column view.

QList<int> QColumnView::columnWidths() const

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

参见 setColumnWidths().

[virtual protected] QAbstractItemView *QColumnView::createColumn(const QModelIndex &index)

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.

参见 setPreviewWidget().

[virtual protected] void QColumnView::currentChanged(const QModelIndex &current, const QModelIndex &previous)

重新实现 QAbstractItemView::currentChanged().

[virtual protected] int QColumnView::horizontalOffset() const

重新实现 QAbstractItemView::horizontalOffset().

[virtual] QModelIndex QColumnView::indexAt(const QPoint &point) const

重新实现 QAbstractItemView::indexAt().

[protected] void QColumnView::initializeColumn(QAbstractItemView *column) const

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.

参见 createColumn().

[virtual protected] bool QColumnView::isIndexHidden(const QModelIndex &index) const

重新实现 QAbstractItemView::isIndexHidden().

[virtual protected] QModelIndex QColumnView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)

重新实现 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() const

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

参见 setPreviewWidget() and updatePreviewWidget().

[virtual protected] void QColumnView::resizeEvent(QResizeEvent *event)

重新实现 QWidget::resizeEvent().

[virtual protected] void QColumnView::rowsInserted(const QModelIndex &parent, int start, int end)

重新实现 QAbstractItemView::rowsInserted().

[virtual protected] void QColumnView::scrollContentsBy(int dx, int dy)

重新实现 QAbstractScrollArea::scrollContentsBy().

[virtual] void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible)

重新实现 QAbstractItemView::scrollTo().

[virtual] void QColumnView::selectAll()

重新实现 QAbstractItemView::selectAll().

void QColumnView::setColumnWidths(const QList<int> &list)

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.

参见 columnWidths() and createColumn().

[virtual] void QColumnView::setModel(QAbstractItemModel *model)

重新实现 QAbstractItemView::setModel().

void QColumnView::setPreviewWidget(QWidget *widget)

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.

参见 previewWidget() and updatePreviewWidget().

[virtual] void QColumnView::setRootIndex(const QModelIndex &index)

重新实现 QAbstractItemView::setRootIndex().

[virtual protected] void QColumnView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command)

重新实现 QAbstractItemView::setSelection().

[virtual] void QColumnView::setSelectionModel(QItemSelectionModel *newSelectionModel)

重新实现 QAbstractItemView::setSelectionModel().

[virtual] QSize QColumnView::sizeHint() const

重新实现 QWidget::sizeHint().

[signal] void QColumnView::updatePreviewWidget(const QModelIndex &index)

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

参见 previewWidget().

[virtual protected] int QColumnView::verticalOffset() const

重新实现 QAbstractItemView::verticalOffset().

[virtual] QRect QColumnView::visualRect(const QModelIndex &index) const

重新实现 QAbstractItemView::visualRect().

[virtual protected] QRegion QColumnView::visualRegionForSelection(const QItemSelection &selection) const

重新实现 QAbstractItemView::visualRegionForSelection().