KColumnHeadersModel Class

A model that converts a model's headers into a list model. More...

Header: #include <KColumnHeadersModel>
CMake: find_package(KF6 REQUIRED COMPONENTS ItemModels)
target_link_libraries(mytarget PRIVATE KF6::ItemModels)
Since: 5.66
Inherits: QAbstractListModel

Public Types

enum ExtraRoles { SortRole }

Properties

Public Functions

KColumnHeadersModel(QObject *parent = nullptr)
void setSortColumn(int newSortColumn)
void setSortOrder(Qt::SortOrder newSortOrder)
void setSourceModel(QAbstractItemModel *newSourceModel)
int sortColumn() const
Qt::SortOrder sortOrder() const
QAbstractItemModel *sourceModel() const

Signals

Detailed Description

This model will expose the source model's headers as a simple list. This is mostly useful as a helper for QML applications that want to display a model's headers.

Each columns's header will be presented as a row in this model. Roles are forwarded directly to the source model's headerData() method.

Member Type Documentation

enum KColumnHeadersModel::ExtraRoles

ConstantValue
KColumnHeadersModel::SortRole0x011D910E

Property Documentation

sortColumn : int

Access functions:

int sortColumn() const
void setSortColumn(int newSortColumn)

Notifier signal:

void sortColumnChanged()

sortOrder : Qt::SortOrder

Access functions:

Qt::SortOrder sortOrder() const
void setSortOrder(Qt::SortOrder newSortOrder)

Notifier signal:

void sortOrderChanged()

sourceModel : QAbstractItemModel*

Access functions:

QAbstractItemModel *sourceModel() const
void setSourceModel(QAbstractItemModel *newSourceModel)

Notifier signal:

void sourceModelChanged()

Member Function Documentation

[explicit] KColumnHeadersModel::KColumnHeadersModel(QObject *parent = nullptr)