Changeset - fa1f343fc299
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 9 years ago 2017-01-01 04:49:24
hy@ozderya.net
added color to channel names
1 file changed with 18 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/channelinfomodel.cpp
Show inline comments
 
@@ -19,6 +19,7 @@
 

	
 
#include "channelinfomodel.h"
 

	
 
#include <QColor>
 
#include <QtDebug>
 

	
 
enum ChannelInfoColumn
 
@@ -28,6 +29,18 @@ enum ChannelInfoColumn
 
    COLUMN_COUNT
 
};
 

	
 
const QColor colors[8] =
 
{
 
    QColor(237,97,68),
 
    QColor(92,200,96),
 
    QColor(225,98,207),
 
    QColor(163,195,58),
 
    QColor(148,123,239),
 
    QColor(212,182,52),
 
    QColor(238,82,133),
 
    QColor(219,136,44)
 
};
 

	
 
ChannelInfoModel::ChannelInfoModel(unsigned numberOfChannels, QObject* parent) :
 
    QAbstractTableModel(parent)
 
{
 
@@ -72,6 +85,11 @@ QVariant ChannelInfoModel::data(const QM
 
        {
 
            return QVariant(infos[index.row()].name);
 
        }
 
        else if (role == Qt::ForegroundRole)
 
        {
 
            // TODO: support more colors than 8
 
            return colors[index.row() % 8];
 
        }
 
    }
 
    else if (index.column() == COLUMN_VISIBILITY)
 
    {
0 comments (0 inline, 0 general)