File indexing completed on 2024-05-19 04:44:33
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public 0015 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 0016 */ 0017 0018 #ifndef SCRIPTINGKRSCRIPTIMAGE_H 0019 #define SCRIPTINGKRSCRIPTIMAGE_H 0020 0021 #include <QObject> 0022 #include <QPointF> 0023 #include <QSizeF> 0024 0025 class KReportItemImage; 0026 0027 namespace Scripting 0028 { 0029 0030 /** 0031 @brief Image item script interface 0032 0033 The user facing interface for scripting report image items 0034 */ 0035 class Image : public QObject 0036 { 0037 Q_OBJECT 0038 public: 0039 explicit Image(KReportItemImage *); 0040 0041 ~Image() override; 0042 public Q_SLOTS: 0043 0044 0045 /** 0046 * Get the position of the barcode 0047 * @return position in points 0048 */ 0049 QPointF position() const; 0050 0051 0052 /** 0053 * Sets the position of the barcode in points 0054 * @param Position 0055 */ 0056 void setPosition(const QPointF&); 0057 0058 /** 0059 * Get the size of the barcode 0060 * @return size in points 0061 */ 0062 QSizeF size() const; 0063 0064 /** 0065 * Set the size of the barcode in points 0066 * @param Size 0067 */ 0068 void setSize(const QSizeF&); 0069 0070 /** 0071 * Get the resize mode for the image 0072 * @return resizeMode Clip or Stretch 0073 */ 0074 QString resizeMode() const; 0075 0076 /** 0077 * Sets the resize mode for the image 0078 * @param ResizeMode "Stretch" or "Clip" default is to clip 0079 */ 0080 void setResizeMode(const QString &); 0081 0082 /** 0083 * Sets the data for the static image 0084 * the data should be base64 encoded 0085 * @param RawImageData 0086 */ 0087 void setInlineImage(const QByteArray&); 0088 0089 /** 0090 * Get the data from a file (expected to be an image) 0091 * the returned data will be base64 encoded 0092 * @param path location of file 0093 */ 0094 void loadFromFile(const QVariant &path); 0095 0096 private: 0097 KReportItemImage *m_image; 0098 0099 }; 0100 0101 } 0102 0103 #endif