Changeset - 3455b67378d9
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 9 years ago 2017-01-01 05:05:51
hy@ozderya.net
added color column
1 file changed with 16 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/channelinfomodel.cpp
Show inline comments
 
@@ -26,6 +26,7 @@ enum ChannelInfoColumn
 
{
 
    COLUMN_NAME = 0,
 
    COLUMN_VISIBILITY,
 
    COLUMN_COLOR,
 
    COLUMN_COUNT
 
};
 

	
 
@@ -68,6 +69,10 @@ Qt::ItemFlags ChannelInfoModel::flags(co
 
    {
 
        return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren | Qt::ItemIsSelectable;
 
    }
 
    else if (index.column() == COLUMN_COLOR)
 
    {
 
        return Qt::ItemIsEnabled | Qt::ItemNeverHasChildren | Qt::ItemIsSelectable;
 
    }
 

	
 
    return Qt::NoItemFlags;
 
}
 
@@ -99,6 +104,13 @@ QVariant ChannelInfoModel::data(const QM
 
            return visible ? Qt::Checked : Qt::Unchecked;
 
        }
 
    }
 
    else if (index.column() == COLUMN_COLOR)
 
    {
 
        if (role == Qt::ForegroundRole || role == Qt::BackgroundRole)
 
        {
 
            return colors[index.row() % 8];
 
        }
 
    }
 

	
 
    return QVariant();
 
}
 
@@ -117,6 +129,10 @@ QVariant ChannelInfoModel::headerData(in
 
            {
 
                return tr("Visible");
 
            }
 
            else if (section == COLUMN_COLOR)
 
            {
 
                return tr("Color");
 
            }
 
        }
 
    }
 
    else                        // vertical
0 comments (0 inline, 0 general)