-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeme.cpp
More file actions
31 lines (26 loc) · 696 Bytes
/
Copy paththeme.cpp
File metadata and controls
31 lines (26 loc) · 696 Bytes
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
#include "theme.h"
Theme::Theme(const QString& name)
: m_name(name)
{
m_colors.reserve(eRolesCount);
for (int i = 0; i < eRolesCount; ++i)
m_colors.push_back(TColorMap());
init();
}
Theme& Theme::setColor(ERole role, quint64 id, const QColor& color)
{
if (role == eRolesCount)
return *this;
m_colors[static_cast<int>(role)][id] = color;
return *this;
}
QColor Theme::color(ERole role, quint64 id, const QString s) const
{
if (role == eRolesCount)
return QColor();
const TColorMap& map = m_colors[static_cast<int>(role)];
TCItColorMap it = map.find(id);
if (it == map.end())
return QColor();
return it->second;
}