Changeset 7b3cd0e for src/mvc/delegate.cpp
- Timestamp:
- 01/20/17 21:46:55 (5 years ago)
- Branches:
- master, qt5
- Children:
- ec7fa22
- Parents:
- ea8416e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mvc/delegate.cpp
rea8416e r7b3cd0e 65 65 // * image 66 66 // * rest is text, which is 1 line of title with big letters and 2 lines of Presenter and Track 67 int aux = option.rect.height() - SPACER - mControls[FavouriteControl On]->image()->height();67 int aux = option.rect.height() - SPACER - mControls[FavouriteControlStrong]->image()->height(); 68 68 Event *event = static_cast<Event*>(index.internalPointer()); 69 69 … … 106 106 c->setEnabled(false); 107 107 } 108 if(event->isFavourite()) 109 mControls[FavouriteControlOn]->paint(painter, option.rect); 110 else 111 mControls[FavouriteControlOff]->paint(painter, option.rect); 108 switch (event->favourite()) { 109 case Favourite_strong: 110 mControls[FavouriteControlStrong]->paint(painter, option.rect); 111 break; 112 case Favourite_weak: 113 mControls[FavouriteControlWeak]->paint(painter, option.rect); 114 break; 115 case Favourite_no: 116 mControls[FavouriteControlNo]->paint(painter, option.rect); 117 break; 118 } 112 119 113 120 if(event->hasAlarm()) … … 125 132 painter->setPen(QPen(event->hasTimeConflict() ? Qt::black : textColor)); 126 133 QPointF titlePointF(option.rect.x() + SPACER, 127 option.rect.y() + SPACER + mControls[FavouriteControl On]->image()->height());134 option.rect.y() + SPACER + mControls[FavouriteControlStrong]->image()->height()); 128 135 QTime start = event->start().time(); 129 136 painter->setFont(fontBig); … … 189 196 painter->setPen(QPen(textColor)); 190 197 painter->setFont(fontSmall); 191 QImage *image = mControls[numFav ? FavouriteControl On : FavouriteControlOff]->image();198 QImage *image = mControls[numFav ? FavouriteControlStrong : FavouriteControlNo]->image(); 192 199 QPoint drawPoint = 193 200 option.rect.topRight() … … 307 314 { 308 315 // FAVOURITE ICONs 309 // on 310 mControls.insert(FavouriteControlOn, new Control(FavouriteControlOn, QString(":icons/favourite-on.png"), NULL)); 311 // off 312 mControls.insert(FavouriteControlOff, new Control(FavouriteControlOff, QString(":icons/favourite-off.png"), NULL)); 316 // strong 317 mControls.insert(FavouriteControlStrong, new Control(FavouriteControlStrong, QString(":icons/favourite-on.png"), NULL)); 318 // weak 319 mControls.insert(FavouriteControlWeak, new Control(FavouriteControlWeak, QString(":icons/favourite-weak.png"), NULL)); 320 // no 321 mControls.insert(FavouriteControlNo, new Control(FavouriteControlNo, QString(":icons/favourite-off.png"), NULL)); 313 322 314 323 // ALARM ICONs 315 324 // on 316 325 mControls.insert(AlarmControlOn, 317 new Control(AlarmControlOn, QString(":icons/alarm-on.png"), mControls[FavouriteControl On]));326 new Control(AlarmControlOn, QString(":icons/alarm-on.png"), mControls[FavouriteControlStrong])); 318 327 // off 319 328 mControls.insert(AlarmControlOff, 320 new Control(AlarmControlOff, QString(":icons/alarm-off.png"), mControls[FavouriteControl Off]));329 new Control(AlarmControlOff, QString(":icons/alarm-off.png"), mControls[FavouriteControlNo])); 321 330 // WARNING ICON 322 331 mControls.insert(WarningControl, … … 339 348 int nrofFavs = 0; 340 349 for(int i=0; i<index.model()->rowCount(index); i++) 341 if(static_cast<Event*>(index.child(i,0).internalPointer())-> isFavourite())350 if(static_cast<Event*>(index.child(i,0).internalPointer())->favourite() != Favourite_no) 342 351 nrofFavs++; 343 352
Note: See TracChangeset
for help on using the changeset viewer.