KReport

KReportElement.cpp
1 /* This file is part of the KDE project
2  * Copyright (C) 2001-2007 by OpenMFG, LLC ([email protected])
3  * Copyright (C) 2007-2008 by Adam Pigg ([email protected])
4  * Copyright (C) 2010-2015 JarosÅ‚aw Staniek <[email protected]>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include "KReportElement.h"
21 
22 #include <QDebug>
23 #include <QHash>
24 
25 KReportElement::~KReportElement()
26 {
27 }
28 
29 void KReportElement::setBackgroundOpacity(qreal backgroundOpacity)
30 {
31  d->backgroundOpacity = qMax(qMin(backgroundOpacity, 1.0), 0.0);
32 }
33 
34 KREPORT_EXPORT QDebug operator<<(QDebug dbg, const KReportElement& element)
35 {
36  dbg.nospace() << qPrintable(
37  QString::fromLatin1("KReportElement: name=\"%1\" rect=%2 z=%3 foregroundColor=%4 "
38  "backgroundColor=%5 backgroundOpacity=%6")
39  .arg(element.name()).arg(QVariant(element.rect()).toString())
40  .arg(element.z()).arg(QVariant(element.foregroundColor()).toString())
41  .arg(QVariant(element.backgroundColor()).toString())
42  .arg(element.backgroundOpacity()));
43  return dbg.space();
44 }
45 
46 KREPORT_EXPORT uint qHash(const KReportElement &element, uint seed) Q_DECL_NOTHROW
47 {
48  return qHash(element.name(), seed)
49  ^ qHash(element.z(), seed)
50  ^ qHash(element.rect().x(), seed)
51  ^ qHash(element.foregroundColor().name(), seed)
52  ^ qHash(element.backgroundColor().name(), seed)
53  ^ qHash(qRound64(element.backgroundOpacity() * 1000.0), seed);
54 }
qreal x() const const
QDebug & nospace()
QString name() const const
QDebug & space()
QDataStream & operator<<(QDataStream &out, const KDateTime &dateTime)
KCALENDARCORE_EXPORT uint qHash(const KCalendarCore::Period &key)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString fromLatin1(const char *str, int size)
The KReportElement class represents a functional visual element of a report design.
QString toString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:17:37 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.