KD Reports API Documentation  2.2
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"
13 #include <QDebug>
14 
15 class KDReports::HtmlElementPrivate
16 {
17 public:
18  QString m_html;
19  QString m_id;
20 };
21 
23  : Element()
24  , d(new HtmlElementPrivate)
25 {
26  d->m_html = html;
27 }
28 
30  : Element(other)
31  , d(new HtmlElementPrivate(*other.d))
32 {
33 }
34 
36 {
37  if (&other == this)
38  return *this;
39  Element::operator=(other);
40  *d = *other.d;
41  return *this;
42 }
43 
45 {
46 }
47 
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 
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 
69 {
70  return new HtmlElement(*this);
71 }
72 
73 void KDReports::HtmlElement::setId(const QString &id)
74 {
75  d->m_id = id;
76 }
77 
79 {
80  return d->m_id;
81 }
82 
84 {
85  return d->m_html;
86 }
Element & operator=(const Element &other)
void build(ReportBuilder &builder) const override
void setHtml(const QString &html)
void setId(const QString &id)
HtmlElement & operator=(const HtmlElement &other)
Element * clone() const override
HtmlElement & operator<<(const QString &)
HtmlElement(const QString &html=QString())
TextDocumentData & currentDocumentData()
void setTextValueMarker(int pos, const QString &id, int valueLength, bool html)

© 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