BibleTime
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
Functions
a
b
c
d
e
f
g
h
i
l
m
n
p
q
r
s
t
v
Variables
a
b
c
d
g
h
i
k
l
m
p
r
s
u
Typedefs
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
p
r
s
t
u
w
Properties
Related Symbols
Files
File List
File Members
All
a
b
c
e
f
h
i
j
k
l
m
o
p
r
s
t
u
w
Functions
b
c
f
i
j
l
m
o
p
r
t
Variables
Typedefs
Enumerations
Enumerator
Macros
a
b
c
i
l
m
r
s
t
u
w
src
frontend
searchdialog
analysis
csearchanalysislegenditem.cpp
Go to the documentation of this file.
1
/*********
2
*
3
* In the name of the Father, and of the Son, and of the Holy Spirit.
4
*
5
* This file is part of BibleTime's source code, https://bibletime.info/
6
*
7
* Copyright 1999-2025 by the BibleTime developers.
8
* The BibleTime source code is licensed under the GNU General Public License
9
* version 2.0.
10
*
11
**********/
12
13
#include "
csearchanalysislegenditem.h
"
14
15
#include <QBrush>
16
#include <QFont>
17
#include <QPainter>
18
#include <QPoint>
19
#include <QRect>
20
#include <QRectF>
21
#include <vector>
22
#include "../../../backend/cswordmodulesearch.h"
23
#include "../../../backend/drivers/cswordmoduleinfo.h"
24
#include "
csearchanalysisscene.h
"
25
26
27
namespace
Search
{
28
29
const
int
ITEM_TEXT_SIZE
= 8;
30
31
const
int
LEGEND_INNER_BORDER
= 5;
32
const
int
LEGEND_DELTAY
= 4;
33
34
35
void
CSearchAnalysisLegendItem::paint
(QPainter* painter,
const
QStyleOptionGraphicsItem*,
QWidget
*) {
36
painter->save();
37
38
//the outer rectangle
39
#define S(...) static_cast<int>(__VA_ARGS__)
40
QPoint p1(
S
(rect().x()),
S
(rect().y()));
41
QPoint p2(
S
(rect().x() + rect().width()),
S
(rect().y() + rect().height()));
42
QRect
r
(p1, p2);
43
r
=
r
.normalized();
44
painter->drawRect(
r
);
45
46
QFont f = painter->font();
47
f.setPointSize(
ITEM_TEXT_SIZE
);
48
painter->setFont(f);
49
50
// for (unsigned int index=0; index < m_moduleList->count(); index++){
51
int
moduleIndex = 0;
52
for
(
auto
const
& result : *
m_results
) {
53
auto
const
*
const
m = result.module;
54
// the module color indicators
55
QPoint p1(
S
(rect().x()) +
LEGEND_INNER_BORDER
,
S
(rect().y()) +
LEGEND_INNER_BORDER
+ moduleIndex*(
LEGEND_DELTAY
+
ITEM_TEXT_SIZE
));
56
#undef S
57
QPoint p2(p1.x() +
ITEM_TEXT_SIZE
, p1.y() +
ITEM_TEXT_SIZE
);
58
QRect
r
(p1, p2);
59
painter->fillRect(
r
, QBrush(
CSearchAnalysisScene::getColor
(moduleIndex)) );
60
r
=
r
.normalized();
61
painter->drawRect(
r
);
62
63
QPoint p3( p2.x() +
LEGEND_INNER_BORDER
, p2.y() );
64
painter->drawText(p3, m->name() );
65
66
++moduleIndex;
67
}
68
painter->restore();
69
}
35
void
CSearchAnalysisLegendItem::paint
(QPainter* painter,
const
QStyleOptionGraphicsItem*,
QWidget
*) {
…
}
70
71
72
}
QWidget
Search::CSearchAnalysisLegendItem::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
Definition
csearchanalysislegenditem.cpp:35
Search::CSearchAnalysisLegendItem::m_results
CSwordModuleSearch::Results const *const m_results
Definition
csearchanalysislegenditem.h:36
Search::CSearchAnalysisScene::getColor
static QColor getColor(int index)
Definition
csearchanalysisscene.cpp:176
S
#define S(...)
csearchanalysislegenditem.h
csearchanalysisscene.h
r
QStringList r(content.left(bodyIndex))
Search
Definition
bibletime.h:26
Search::LEGEND_DELTAY
const int LEGEND_DELTAY
Definition
csearchanalysislegenditem.cpp:32
Search::ITEM_TEXT_SIZE
const int ITEM_TEXT_SIZE
Definition
csearchanalysisitem.cpp:27
Search::LEGEND_INNER_BORDER
const int LEGEND_INNER_BORDER
Definition
csearchanalysislegenditem.cpp:31
Generated by
1.9.8