Changeset 699d5b8
- Timestamp:
- 01/21/10 14:38:39 (13 years ago)
- Branches:
- master, qt5
- Children:
- 6a807e7
- Parents:
- 06570e9
- Location:
- src/mvc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mvc/delegate.cpp
r06570e9 r699d5b8 35 35 36 36 painter->save(); 37 38 37 QColor bkgrColor = Qt::cyan; 38 39 39 QPen borderPen(bkgrColor.darker()); 40 40 //QColor bkgrColor = QColor(0,0,113); … … 64 64 65 65 //int spacer = (fmSmall.boundingRect("999").width() < SPACER) ? SPACER : fmSmall.boundingRect("999").width(); 66 67 //Time conflicts are colored differently 68 if ((static_cast<Event*>(index.internalPointer())->isFavourite()) 69 && (hasTimeConflict(index, index.parent()))) 70 { 71 bkgrColor = Qt::yellow; 72 } 66 73 67 74 if(isLast(index)) … … 127 134 painter->drawImage(mControls[MapControl]->drawPoint(option.rect),*mControls[MapControl]->image()); 128 135 // Time conflict 129 if(static_cast<Event*>(index.internalPointer())->hasTimeConflict()) 136 //if(static_cast<Event*>(index.internalPointer())->hasTimeConflict()) 137 if(bkgrColor == Qt::yellow) 130 138 painter->drawImage(mControls[WarningControlOn]->drawPoint(option.rect),*mControls[WarningControlOn]->image()); 131 139 else … … 406 414 } 407 415 416 bool Delegate::hasTimeConflict(const QModelIndex &index, const QModelIndex &parent) const 417 { 418 Event *event = static_cast<Event*>(index.internalPointer()); 419 QTime start = event->start().time(); 420 QTime end = start.addSecs(event->duration()); 421 for(int i=0; i<parent.model()->rowCount(parent); i++) 422 { 423 if((event->id()!=static_cast<Event*>(parent.child(i,0).internalPointer())->id()) 424 && 425 (static_cast<Event*>(parent.child(i,0).internalPointer())->isFavourite())) 426 { 427 if (((start >= static_cast<Event*>(parent.child(i,0).internalPointer())->start().time()) 428 && 429 (start <= static_cast<Event*>(parent.child(i,0).internalPointer())->start().time().addSecs(static_cast<Event*>(parent.child(i,0).internalPointer())->duration()))) 430 || 431 ((end >= static_cast<Event*>(parent.child(i,0).internalPointer())->start().time()) 432 && 433 (end <= static_cast<Event*>(parent.child(i,0).internalPointer())->start().time().addSecs(static_cast<Event*>(parent.child(i,0).internalPointer())->duration())))) 434 { 435 return true; 436 } 437 } 438 } 439 return false; 440 } -
src/mvc/delegate.h
r06570e9 r699d5b8 72 72 int numberOfFavourities(const QModelIndex &index) const; 73 73 int numberOfAlarms(const QModelIndex &index) const; 74 bool hasTimeConflict(const QModelIndex &index, const QModelIndex &parent) const; 74 75 75 76 private:
Note: See TracChangeset
for help on using the changeset viewer.