# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2016-12-31 15:07:12 # Node ID 9d804dc195ac8e693455e786ddf832622fee13e8 # Parent e423f1347315f230584736ed02bcc89b5258907d display correct column names diff --git a/src/channelinfomodel.cpp b/src/channelinfomodel.cpp --- a/src/channelinfomodel.cpp +++ b/src/channelinfomodel.cpp @@ -86,6 +86,33 @@ QVariant ChannelInfoModel::data(const QM return QVariant(); } +QVariant ChannelInfoModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (orientation == Qt::Horizontal) + { + if (role == Qt::DisplayRole) + { + if (section == COLUMN_NAME) + { + return tr("Channel"); + } + else if (section == COLUMN_VISIBILITY) + { + return tr("Visible"); + } + } + } + else // vertical + { + if (section < (int) _numOfChannels && role == Qt::DisplayRole) + { + return QString::number(section + 1); + } + } + + return QVariant(); +} + bool ChannelInfoModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (index.row() >= (int) _numOfChannels) diff --git a/src/channelinfomodel.h b/src/channelinfomodel.h --- a/src/channelinfomodel.h +++ b/src/channelinfomodel.h @@ -36,6 +36,7 @@ public: QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); Qt::ItemFlags flags(const QModelIndex &index) const; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; void setNumOfChannels(unsigned number);