- _first.paint_label(p, rect, prefix);
- _second.paint_label(p, rect, prefix);
+ assert(first_);
+ assert(second_);
+
+ if (!enabled())
+ return;
+
+ const QColor text_colour =
+ ViewItem::select_text_colour(Cursor::FillColour);
+
+ p.setPen(text_colour);
+ compute_text_size(p);
+ QRectF delta_rect(label_rect(rect));
+
+ const int radius = delta_rect.height() / 2;
+ const QRectF text_rect(delta_rect.intersected(
+ rect).adjusted(radius, 0, -radius, 0));
+ if (text_rect.width() >= text_size_.width()) {
+ const int highlight_radius = delta_rect.height() / 2 - 2;
+
+ if (selected()) {
+ p.setBrush(Qt::transparent);
+ p.setPen(highlight_pen());
+ p.drawRoundedRect(delta_rect, radius, radius);
+ }
+
+ p.setBrush(hover ? Cursor::FillColour.lighter() :
+ Cursor::FillColour);
+ p.setPen(Cursor::FillColour.darker());
+ p.drawRoundedRect(delta_rect, radius, radius);
+
+ delta_rect.adjust(1, 1, -1, -1);
+ p.setPen(Cursor::FillColour.lighter());
+ p.drawRoundedRect(delta_rect, highlight_radius, highlight_radius);
+
+ p.setPen(text_colour);
+ p.drawText(text_rect, Qt::AlignCenter | Qt::AlignVCenter,
+ format_string());
+ }