Changeset 1343ea4 in confclerk_git for src/mvc/delegate.cpp
- Timestamp:
- 01/20/17 23:04:17 (6 years ago)
- Branches:
- master, qt5
- Children:
- 81d87d7
- Parents:
- ec7fa22
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mvc/delegate.cpp
rec7fa22 r1343ea4 61 61 if(hasParent(index)) 62 62 { 63 Event *event = static_cast<Event*>(index.internalPointer()); 64 65 // determine severity of conflict 66 Favourite eventTimeConflict = event->timeConflict(); // cache value as event->timeConflict is expensive 67 enum ConflictSeverity {csNone, csWeak, csStrong} conflictSeverity; 68 switch (event->favourite()) { 69 case Favourite_strong: 70 conflictSeverity = (eventTimeConflict == Favourite_strong) ? csStrong : csNone; 71 break; 72 case Favourite_weak: 73 conflictSeverity = (eventTimeConflict == Favourite_no) ? csNone : csWeak; 74 break; 75 case Favourite_no: 76 conflictSeverity = csNone; 77 break; 78 } 79 63 80 // entry horizontal layout: 64 81 // * spacer (aka y position of image) … … 66 83 // * rest is text, which is 1 line of title with big letters and 2 lines of Presenter and Track 67 84 int aux = option.rect.height() - SPACER - mControls[FavouriteControlStrong]->image()->height(); 68 Event *event = static_cast<Event*>(index.internalPointer());69 85 70 86 // font SMALL … … 89 105 90 106 // background (in case of time conflicts) 91 if (event->hasTimeConflict()) {92 painter->setBrush( Qt::yellow);107 if (conflictSeverity != csNone) { 108 painter->setBrush(conflictSeverity == csStrong ? Qt::yellow : QColor("lightyellow")); 93 109 painter->setPen(Qt::NoPen); 94 110 painter->drawRect(option.rect); … … 123 139 mControls[AlarmControlOff]->paint(painter, option.rect); 124 140 125 if(event ->hasTimeConflict())141 if(eventTimeConflict != Favourite_no) 126 142 mControls[WarningControl]->paint(painter, option.rect); 127 143 … … 130 146 // ("position of text" is lower-left angle of the first letter, 131 147 // so the first line is actually at the same height as the image) 132 painter->setPen(QPen( event->hasTimeConflict()? Qt::black : textColor));148 painter->setPen(QPen(conflictSeverity != csNone ? Qt::black : textColor)); 133 149 QPointF titlePointF(option.rect.x() + SPACER, 134 150 option.rect.y() + SPACER + mControls[FavouriteControlStrong]->image()->height());
Note: See TracChangeset
for help on using the changeset viewer.