Quote Originally Posted by divanov View Post
Selection colours are actually coming from Fremantle default themes, but if you don't like them for some reason, you can make custom themes for your application.
How can we have the rows/columns in Qtableiew/QListview/QTableWidget coloured in Fremantle ? Ive tried to implement a delegate to paint each row but it didnt seem to work fine. I would also like it to show a different color when selected.
Can this be elaborated please as to how it can achieved ?

this is my example, ive managed to color the text here , the Qt:Window color role didnt help in coloring the backround of the columns.

Thanks for the time.

Code:
void TableViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
                                  const QModelIndex &index) const
{
    QPalette pal = option.palette;
    QStyleOptionViewItem  viewOption(option);
    if(index.column() == 1)
    {
        viewOption.palette.setColor(QPalette::Text, Qt::green);
    }
    else if (index.column() == 2)
    {
        viewOption.palette.setColor(QPalette::Text, Qt::red);
    }
    else if (index.column() == 3)
    {
        viewOption.palette.setColor(QPalette::Text, Qt::yellow);
    }
    else
    {
        viewOption.palette.setColor(QPalette::Text, Qt::white);
    }

    QStyledItemDelegate::paint(painter, viewOption, index);
}