Multi diag tools
|
HeaderProxyModel provides a simple way to set custom headers. More...
#include <HeaderProxyModel.h>
Inherits QIdentityProxyModel.
Public Member Functions | |
HeaderProxyModel (QObject *parent=nullptr) | |
Constructor. | |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
Get header data. More... | |
QVariant | horizontalHeaderData (int column, int role=Qt::DisplayRole) const |
Get horizontal header data. More... | |
void | setHorizontalHeaderLabels (const QStringList &labels) |
Set horizontal header labels. | |
HeaderProxyModel provides a simple way to set custom headers.
Common way to use Qt's item/view is to implement a item model, that let the user access relevant data. Such model also should implement header data access methodes. But, for some cases, it can be enouth to work with a existing model, such as VariantTableModel, that do not provide header data methods. In the latter case, HeaderProxyModel can be used.
Typical usage:
Definition at line 63 of file HeaderProxyModel.h.
|
override |
QVariant Mdt::ItemModel::HeaderProxyModel::horizontalHeaderData | ( | int | column, |
int | role = Qt::DisplayRole |
||
) | const |
Get horizontal header data.
If some horizontal header data has been set, and column is in that bound, these header data will be returned. Else, if a source model has allready been set, the header data from this model will be returned. Else, a null QVariant is returned.
Definition at line 38 of file HeaderProxyModel.cpp.