KReport

KReportScriptImage.cpp
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
18#include "KReportScriptImage.h"
19#include "KReportItemImage.h"
20
21#include <KProperty>
22
23namespace Scripting
24{
25
26Image::Image(KReportItemImage *i)
27{
28 m_image = i;
29}
30
31
32Image::~Image()
33{
34}
35
37{
38 return m_image->position();
39}
41{
42 m_image->setPosition(p);
43}
44
46{
47 return m_image->size();
48}
49void Image::setSize(const QSizeF& s)
50{
51 m_image->setSize(s);
52}
53
55{
56 return m_image->m_resizeMode->value().toString();
57}
58
60{
61 if (rm == QLatin1String("Stretch")) {
62 m_image->m_resizeMode->setValue(QLatin1String("Stretch"));
63 } else {
64 m_image->m_resizeMode->setValue(QLatin1String("Clip"));
65 }
66}
67
69{
70 m_image->setInlineImageData(ba);
71}
72
74{
75 QString str = path.toString();
76 m_image->setInlineImageData(QByteArray(), str);
77}
78}
QVariant value() const
bool setValue(const QVariant &value, ValueOptions options=ValueOptions())
void setSize(const QSizeF &ptSize)
Sets size for the element.
QPointF position() const
Return the position in points.
void setPosition(const QPointF &ptPos)
Sets position for the element.
QSizeF size() const
Return the size in points.
void setResizeMode(const QString &)
Sets the resize mode for the image.
QPointF position() const
Get the position of the barcode.
QString resizeMode() const
Get the resize mode for the image.
void loadFromFile(const QVariant &path)
Get the data from a file (expected to be an image) the returned data will be base64 encoded.
void setSize(const QSizeF &)
Set the size of the barcode in points.
void setInlineImage(const QByteArray &)
Sets the data for the static image the data should be base64 encoded.
QSizeF size() const
Get the size of the barcode.
void setPosition(const QPointF &)
Sets the position of the barcode in points.
Field item script interface.
QString toString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:16:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.