Changeset d7986a6 for src/mvc


Ignore:
Timestamp:
02/01/10 16:32:31 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
a7d8638
Parents:
b4e9936
Message:

gradient for treeview items

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/delegate.cpp

    rb4e9936 rd7986a6  
    3636    painter->save();
    3737    QColor bkgrColor = Qt::cyan;
     38    //QColor bkgrColor = QColor(0xAA,0xAA,0xAA);
     39    QColor conflictColor = Qt::yellow;
    3840
    3941    QPen borderPen(bkgrColor.darker());
    40     //QColor bkgrColor = QColor(0,0,113);
    41     //QPen borderPen(Qt::cyan);
    4242    if(hasParent(index))
    4343    {
     
    6767        //Time conflicts are colored differently
    6868        if(static_cast<Event*>(index.internalPointer())->hasTimeConflict())
    69             bkgrColor = Qt::yellow;
     69            bkgrColor = conflictColor;
     70
     71        QLinearGradient itemGradient(option.rect.topLeft(), option.rect.bottomLeft());
     72        itemGradient.setColorAt(0.0, Qt::white);
     73        itemGradient.setColorAt(0.25, bkgrColor);
     74        itemGradient.setColorAt(0.5, bkgrColor);
     75        itemGradient.setColorAt(0.75, bkgrColor);
     76        itemGradient.setColorAt(1.0, Qt::white);
    7077
    7178        if(isLast(index))
    7279        {
    73             QLinearGradient lastGradient(option.rect.topLeft(), option.rect.bottomLeft());
    74             lastGradient.setColorAt(0.0, Qt::white);
    75             lastGradient.setColorAt(0.5, bkgrColor);
    76             lastGradient.setColorAt(1.0, Qt::white);
    77 
    7880            QPainterPath endPath;
    7981            endPath.moveTo(option.rect.topLeft());
     
    8486            endPath.lineTo(option.rect.topRight());
    8587
    86             painter->setBrush( bkgrColor );
    87             //painter->setBrush(lastGradient);
     88            //painter->setBrush( bkgrColor );
     89            painter->setBrush(itemGradient);
    8890            painter->setPen(borderPen);
    8991            painter->drawPath(endPath);
     
    9395        else // middle elements
    9496        {
    95             QLinearGradient middleGradient(option.rect.topLeft(), option.rect.bottomLeft());
    96             middleGradient.setColorAt(0.0, Qt::white);
    97             middleGradient.setColorAt(0.25, bkgrColor);
    98             middleGradient.setColorAt(0.5, Qt::white);
    99             middleGradient.setColorAt(0.75, bkgrColor);
    100             middleGradient.setColorAt(1.0, Qt::white);
    101 
    102             painter->setBrush( bkgrColor );
    103             //painter->setBrush(middleGradient);
     97            //painter->setBrush( bkgrColor );
     98            painter->setBrush(itemGradient);
    10499            painter->setPen(Qt::NoPen);
    105100            painter->drawRect(option.rect);
Note: See TracChangeset for help on using the changeset viewer.