- QPointF titlePointF;
- titlePointF = QPoint(option.rect.x()+SPACER,option.rect.y()+option.rect.height()-10);
- QString text = qVariantValue<QString>(index.data()) + ": " + static_cast<Event*>(index.internalPointer())->title();
- painter->drawText(titlePointF,text);
- }
- else // doesn't have parent - time-groups' elements (top items)
- {
- QLinearGradient titleGradient(option.rect.topLeft(), option.rect.topRight());
- //titleGradient.setColorAt(0.0, Qt::white);
- titleGradient.setColorAt(0.0, bkgrColor);
- titleGradient.setColorAt(0.5, Qt::white);
- titleGradient.setColorAt(1.0, bkgrColor);
-
- QPainterPath titlePath;
- if(isExpanded(index))
- {
- titlePath.moveTo(option.rect.bottomLeft());
- titlePath.lineTo(option.rect.topLeft()+QPoint(0, RADIUS));
- titlePath.arcTo(option.rect.left(), option.rect.top(), 2*RADIUS, 2*RADIUS, 180, -90);
- titlePath.lineTo(option.rect.topRight()-QPoint(RADIUS, 0));
- titlePath.arcTo(option.rect.right()-2*RADIUS, option.rect.top(), 2*RADIUS, 2*RADIUS, 90, -90);
- titlePath.lineTo(option.rect.bottomRight());
- titlePath.closeSubpath();
- }
- else
+ // it starts just below the image
+ // ("position of text" is lower-left angle of the first letter,
+ // so the first line is actually at the same height as the image)
+ painter->setPen(QPen(conflictSeverity != csNone ? Qt::black : textColor));
+ QPointF titlePointF(option.rect.x() + SPACER,
+ option.rect.y() + SPACER + mControls[FavouriteControlStrong]->image()->height());
+ QTime start = event->start().time();
+ painter->setFont(fontBig);
+ painter->drawText(titlePointF,start.toString("hh:mm") + "-" + start.addSecs(event->duration()).toString("hh:mm") + ", " + event->roomName());
+
+ // title
+ titlePointF.setY(titlePointF.y()+fmBig.height()-fmBig.descent());
+ painter->setFont(fontBigB);
+ QString title = event->title();
+ if(fmBigB.boundingRect(title).width() > (option.rect.width()-2*SPACER)) // the title won't fit the screen