KReport

KReportScriptSection.h
1/* This file is part of the KDE project
2 * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17#ifndef KRSCRIPTSECTION_H
18#define KRSCRIPTSECTION_H
19
20#include <QObject>
21#include <QtQml/QJSValue>
22
24
25/**
26 @brief Report section object user scripting API.
27
28 Contains methods for a report section object which can be called by user scripts. \n
29
30 Example: \n
31 \code
32 function detail()
33 {
34 this.OnRender = function()
35 {
36 debug.print("Rendering detail section!");
37 }
38 }
39 reportname.section_detail.initialize(new detail())
40 \endcode
41*/
42namespace Scripting
43{
44class Section : public QObject
45{
47public:
48 explicit Section(KReportSectionData*);
49
50 ~Section() override;
51
52public Q_SLOTS:
53 //! @return the background color of the section
54 QColor backgroundColor() const;
55
56 //! Sets the background color of the section to the given color
57 void setBackgroundColor(const QColor&);
58
59 //! @return the section height as a real number, in points
60 qreal height() const;
61
62 //! Sets the section height to the given value in points
63 void setHeight(qreal);
64
65 //! @return the name of the section
66 QString name() const;
67
68 //! @return an object in the section, by number
69 QObject* objectByNumber(int);
70
71 //! @return an object in the section, by name
72 QObject* objectByName(const QString&);
73
74 //! Assigns a user object to this section
75 void initialize(const QJSValue &s);
76
77 //! Executed when the report is opened. If a handler exists for this in the user object it is called.
78 void eventOnRender();
79
80private:
81 KReportSectionData *m_section;
82 QJSValue m_scriptObject;
83};
84}
85#endif
KReportSectionData is used to store the information about a specific report section.
Field item script interface.
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:06:04 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.