KReport

KReportScriptImage.cpp
1 /* This file is part of the KDE project
2  * Copyright (C) 2007-2008 by Adam Pigg ([email protected])
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 
23 namespace Scripting
24 {
25 
26 Image::Image(KReportItemImage *i)
27 {
28  m_image = i;
29 }
30 
31 
32 Image::~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 }
49 void 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 
73 void Image::loadFromFile(const QVariant &path)
74 {
75  QString str = path.toString();
76  m_image->setInlineImageData(QByteArray(), str);
77 }
78 }
QString resizeMode() const
Get the resize mode for the image.
QSizeF size() const
Get the size of the barcode.
void setInlineImage(const QByteArray &)
Sets the data for the static image the data should be base64 encoded.
void setSize(const QSizeF &)
Set the size of the barcode in points.
Field item script interface.
void setResizeMode(const QString &)
Sets the resize mode for the image.
void setPosition(const QPointF &)
Sets the position of the barcode in points.
QPointF position() const
Get the position of the barcode.
void loadFromFile(const QVariant &path)
Get the data from a file (expected to be an image) the returned data will be base64 encoded.
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.