blob: 0aac2220258988b4540687ad6e62d57262156ed4 (
plain)
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
43
44
45
46
47
48
49
50
51
52
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include "../core_global.h"
#include <QColor>
#include <QHash>
namespace Core {
class CORE_EXPORT SearchResultColor
{
public:
enum class Style { Default, Alt1, Alt2 };
SearchResultColor() = default;
SearchResultColor(const QColor &textBg, const QColor &textFg,
const QColor &highlightBg, const QColor &highlightFg,
const QColor &functionBg, const QColor &functionFg
)
: textBackground(textBg), textForeground(textFg),
highlightBackground(highlightBg), highlightForeground(highlightFg),
containingFunctionBackground(functionBg),containingFunctionForeground(functionFg)
{
if (!highlightBackground.isValid())
highlightBackground = textBackground;
if (!highlightForeground.isValid())
highlightForeground = textForeground;
if (!containingFunctionBackground.isValid())
containingFunctionBackground = textBackground;
if (!containingFunctionForeground.isValid())
containingFunctionForeground = textForeground;
}
friend auto qHash(SearchResultColor::Style style)
{
return QT_PREPEND_NAMESPACE(qHash(int(style)));
}
QColor textBackground;
QColor textForeground;
QColor highlightBackground;
QColor highlightForeground;
QColor containingFunctionBackground;
QColor containingFunctionForeground;
};
using SearchResultColors = QHash<SearchResultColor::Style, SearchResultColor>;
} // namespace Core
|