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
35 lines (30 loc) · 1.08 KB
/
customapplicationstyle.cpp
File metadata and controls
35 lines (30 loc) · 1.08 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
#include "customapplicationstyle.h"
#include <QPainter>
#include <QStyleOption>
#include "editorsettingsoptions.h"
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 color(207, 207, 207);
QPen pen(color);
pen.setWidth(2);
painter->setPen(pen);
if (option->rect.height() == 0) {
color.setAlpha(50);
painter->setBrush(color);
painter->drawLine(option->rect.topLeft(), option->rect.topRight());
} else {
color.setAlpha(200);
painter->fillRect(option->rect, color);
}
} else {
QProxyStyle::drawPrimitive(element, option, painter, widget);
}
}
void CustomApplicationStyle::setTheme(Theme::Value theme)
{
m_theme = theme;
}
CustomApplicationStyle::CustomApplicationStyle() : m_theme(Theme::Light) { }