KD Reports API Documentation
2.2
src
KDReports
KDReportsHtmlElement.cpp
Go to the documentation of this file.
1
/****************************************************************************
2
**
3
** This file is part of the KD Reports library.
4
**
5
** SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6
**
7
** SPDX-License-Identifier: MIT
8
**
9
****************************************************************************/
10
11
#include "
KDReportsHtmlElement.h
"
12
#include "
KDReportsReportBuilder_p.h
"
13
#include <QDebug>
14
15
class
KDReports::HtmlElementPrivate
16
{
17
public
:
18
QString m_html;
19
QString m_id;
20
};
21
22
KDReports::HtmlElement::HtmlElement
(
const
QString &html)
23
:
Element
()
24
, d(new HtmlElementPrivate)
25
{
26
d->m_html =
html
;
27
}
28
29
KDReports::HtmlElement::HtmlElement
(
const
HtmlElement
&other)
30
:
Element
(other)
31
, d(new HtmlElementPrivate(*other.d))
32
{
33
}
34
35
KDReports::HtmlElement
&
KDReports::HtmlElement::operator=
(
const
HtmlElement
&other)
36
{
37
if
(&other ==
this
)
38
return
*
this
;
39
Element::operator=
(other);
40
*d = *other.d;
41
return
*
this
;
42
}
43
44
KDReports::HtmlElement::~HtmlElement
()
45
{
46
}
47
48
void
KDReports::HtmlElement::build
(
ReportBuilder
&builder)
const
49
{
50
QTextCursor &cursor = builder.
cursor
();
51
const
int
charPosition = cursor.position();
52
cursor.insertHtml(d->m_html);
53
if
(!d->m_id.isEmpty())
54
builder.
currentDocumentData
().
setTextValueMarker
(charPosition, d->m_id, cursor.position(),
false
);
55
}
56
57
KDReports::HtmlElement
&
KDReports::HtmlElement::operator<<
(
const
QString &str)
58
{
59
d->m_html.append(str);
60
return
*
this
;
61
}
62
63
void
KDReports::HtmlElement::setHtml
(
const
QString &html)
64
{
65
d->m_html = html;
66
}
67
68
KDReports::Element
*
KDReports::HtmlElement::clone
()
const
69
{
70
return
new
HtmlElement
(*
this
);
71
}
72
73
void
KDReports::HtmlElement::setId
(
const
QString &
id
)
74
{
75
d->m_id = id;
76
}
77
78
QString
KDReports::HtmlElement::id
()
const
79
{
80
return
d->m_id;
81
}
82
83
QString
KDReports::HtmlElement::html
()
const
84
{
85
return
d->m_html;
86
}
KDReportsHtmlElement.h
KDReportsReportBuilder_p.h
KDReports::Element
Definition:
KDReportsElement.h:35
KDReports::Element::operator=
Element & operator=(const Element &other)
Definition:
KDReportsElement.cpp:30
KDReports::HtmlElement
Definition:
KDReportsHtmlElement.h:26
KDReports::HtmlElement::build
void build(ReportBuilder &builder) const override
Definition:
KDReportsHtmlElement.cpp:48
KDReports::HtmlElement::id
QString id() const
Definition:
KDReportsHtmlElement.cpp:78
KDReports::HtmlElement::setHtml
void setHtml(const QString &html)
Definition:
KDReportsHtmlElement.cpp:63
KDReports::HtmlElement::html
QString html() const
Definition:
KDReportsHtmlElement.cpp:83
KDReports::HtmlElement::setId
void setId(const QString &id)
Definition:
KDReportsHtmlElement.cpp:73
KDReports::HtmlElement::~HtmlElement
~HtmlElement() override
Definition:
KDReportsHtmlElement.cpp:44
KDReports::HtmlElement::operator=
HtmlElement & operator=(const HtmlElement &other)
Definition:
KDReportsHtmlElement.cpp:35
KDReports::HtmlElement::clone
Element * clone() const override
Definition:
KDReportsHtmlElement.cpp:68
KDReports::HtmlElement::operator<<
HtmlElement & operator<<(const QString &)
Definition:
KDReportsHtmlElement.cpp:57
KDReports::HtmlElement::HtmlElement
HtmlElement(const QString &html=QString())
Definition:
KDReportsHtmlElement.cpp:22
KDReports::ReportBuilder
Definition:
KDReportsReportBuilder_p.h:36
KDReports::ReportBuilder::currentDocumentData
TextDocumentData & currentDocumentData()
Definition:
KDReportsReportBuilder_p.h:68
KDReports::ReportBuilder::cursor
QTextCursor & cursor()
Definition:
KDReportsReportBuilder_p.h:44
KDReports::TextDocumentData::setTextValueMarker
void setTextValueMarker(int pos, const QString &id, int valueLength, bool html)
Definition:
KDReportsTextDocumentData.cpp:81
© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-reports/
Generated by doxygen 1.9.1