Pages
API Documentation
On this page

KRearrangeColumnsProxyModel Class

This proxy shows specific columns from the source model, in any order. More...

  • Header: #include <KRearrangeColumnsProxyModel>
  • CMake: find_package(KF6 REQUIRED COMPONENTS ItemModels)
    target_link_libraries(mytarget PRIVATE KF6::ItemModels)
  • Inherits: QIdentityProxyModel

List of all members, including inherited members

Public Functions

Detailed Description

This allows to reorder columns, as well as not showing all of them.

The proxy supports source models that have a tree structure. It also supports editing, and propagating changes from the source model.

Showing the same source column more than once is not supported.

Member Function Documentation

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

Creates a KRearrangeColumnsProxyModel proxy. Remember to call setSourceModel() afterwards.

int KRearrangeColumnsProxyModel::proxyColumnForSourceColumn(int sourceColumn) const

Returns the proxy column for the given source column or -1 if the source column isn't shown in the proxy.

void KRearrangeColumnsProxyModel::setSourceColumns(const QList<int> &columns)

Set the chosen source columns, in the desired order for the proxy columns columns[proxyColumn=0] is the source column to show in the first proxy column, etc.

Example: QList<int>() << 2 << 1; This examples configures the proxy to hide column 0, show column 2 from the source model, then show column 1 from the source model.

int KRearrangeColumnsProxyModel::sourceColumnForProxyColumn(int proxyColumn) const

Returns the source column for the given proxy column.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.