Changeset View
Changeset View
Standalone View
Standalone View
libapper/CategoryDrawer.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 39 | { | |||
---|---|---|---|---|---|
44 | painter->setRenderHint(QPainter::Antialiasing); | 44 | painter->setRenderHint(QPainter::Antialiasing); | ||
45 | 45 | | |||
46 | const QRect optRect = option.rect; | 46 | const QRect optRect = option.rect; | ||
47 | QFont font(QApplication::font()); | 47 | QFont font(QApplication::font()); | ||
48 | font.setBold(true); | 48 | font.setBold(true); | ||
49 | const QFontMetrics fontMetrics = QFontMetrics(font); | 49 | const QFontMetrics fontMetrics = QFontMetrics(font); | ||
50 | const int height = categoryHeight(index, option); | 50 | const int height = categoryHeight(index, option); | ||
51 | 51 | | |||
52 | //BEGIN: decoration gradient | | |||
53 | { | | |||
54 | QPainterPath path(optRect.bottomLeft()); | | |||
55 | path.lineTo(QPoint(optRect.topLeft().x(), optRect.topLeft().y() - 3)); | | |||
56 | const QPointF topLeft(optRect.topLeft()); | | |||
57 | QRectF arc(topLeft, QSizeF(4, 4)); | | |||
58 | path.arcTo(arc, 180, -90); | | |||
59 | path.lineTo(optRect.topRight()); | | |||
60 | path.lineTo(optRect.bottomRight()); | | |||
61 | path.lineTo(optRect.bottomLeft()); | | |||
62 | | ||||
63 | QColor window(option.palette.window().color()); | | |||
64 | const QColor base(option.palette.base().color()); | | |||
65 | | ||||
66 | window.setAlphaF(0.4); | | |||
67 | | ||||
68 | QLinearGradient decoGradient1(optRect.topLeft(), optRect.bottomLeft()); | | |||
69 | decoGradient1.setColorAt(0, window); | | |||
70 | decoGradient1.setColorAt(1, Qt::transparent); | | |||
71 | | ||||
72 | QLinearGradient decoGradient2(optRect.topLeft(), optRect.topRight()); | | |||
73 | decoGradient2.setColorAt(0, Qt::transparent); | | |||
74 | decoGradient2.setColorAt(1, base); | | |||
75 | | ||||
76 | painter->fillPath(path, decoGradient1); | | |||
77 | painter->fillPath(path, decoGradient2); | | |||
78 | } | | |||
79 | //END: decoration gradient | | |||
80 | | ||||
81 | { | 52 | { | ||
82 | QRect newOptRect(optRect); | 53 | QRect newOptRect(optRect); | ||
83 | newOptRect.setLeft(newOptRect.left() + 1); | 54 | newOptRect.setLeft(newOptRect.left() + 1); | ||
84 | newOptRect.setTop(newOptRect.top() + 1); | 55 | newOptRect.setTop(newOptRect.top() + 1); | ||
85 | 56 | | |||
86 | //BEGIN: inner top left corner | 57 | //BEGIN: inner top left corner | ||
87 | { | 58 | { | ||
88 | painter->save(); | 59 | painter->save(); | ||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |