forked from nuttyartist/notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomapplicationstyle.cpp
More file actions
42 lines (37 loc) · 1.16 KB
/
Copy pathcustomapplicationstyle.cpp
File metadata and controls
42 lines (37 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "customapplicationstyle.h"
#include <QPainter>
#include <QStyleOption>
void CustomApplicationStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
if(element == QStyle::PE_IndicatorItemViewItemDrop)
{
painter->setRenderHint(QPainter::Antialiasing, true);
QColor c;
// if (m_theme == Theme::Dark) {
// c = QColor(15, 45, 90);
// } else {
c = QColor(207, 207, 207);
// }
QPen pen(c);
pen.setWidth(2);
c.setAlpha(50);
QBrush brush(c);
painter->setPen(pen);
painter->setBrush(brush);
if(option->rect.height() == 0) {
painter->drawLine(option->rect.topLeft(), option->rect.topRight());
} else {
c.setAlpha(200);
QBrush brush(c);
painter->fillRect(option->rect, brush);
}
} else {
QProxyStyle::drawPrimitive(element, option, painter, widget);
}
}
void CustomApplicationStyle::setTheme(Theme newTheme)
{
m_theme = newTheme;
}
CustomApplicationStyle::CustomApplicationStyle() : m_theme(Theme::Light)
{}