Changeset - 9d804dc195ac
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 9 years ago 2016-12-31 15:07:12
hy@ozderya.net
display correct column names
2 files changed with 28 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/channelinfomodel.cpp
Show inline comments
 
@@ -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)
src/channelinfomodel.h
Show inline comments
 
@@ -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);
 

	
0 comments (0 inline, 0 general)