File indexing completed on 2024-05-19 04:44:32
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 KRSCRIPTFIELD_H 0019 #define KRSCRIPTFIELD_H 0020 0021 #include <QObject> 0022 0023 #include "KReportItemField.h" 0024 0025 /** 0026 @brief Field item script interface 0027 0028 The user facing interface for scripting report field items 0029 */ 0030 namespace Scripting 0031 { 0032 /** 0033 @brief Field script interface 0034 0035 The user facing interface for scripting report fields 0036 */ 0037 class Field : public QObject 0038 { 0039 Q_OBJECT 0040 public: 0041 explicit Field(KReportItemField*); 0042 0043 ~Field() override; 0044 0045 public Q_SLOTS: 0046 0047 //! @return the data source for the field element 0048 //! The source can be a column name or a valid script expression if prefixed with a '='. 0049 QString source() const; 0050 0051 //! Sets the data source for the field element. 0052 //! @see source() 0053 void setSource(const QString &s); 0054 0055 //! @return the horizontal alignment as an integer 0056 //! Valid values are left: -1, center: 0, right; 1 0057 int horizontalAlignment() const; 0058 0059 //! Sets the horizontal alignment 0060 //! Valid values for alignment are left: -1, center: 0, right; 1 0061 void setHorizonalAlignment(int); 0062 0063 //! @return the vertical alignment 0064 //! Valid values are top: -1, middle: 0, bottom: 1 0065 int verticalAlignment() const; 0066 0067 //! Sets the vertical alignment 0068 //! Valid values for aligmnt are top: -1, middle: 0, bottom: 1 0069 void setVerticalAlignment(int); 0070 0071 //! @return the background color of the lable 0072 QColor backgroundColor() const; 0073 0074 //! Set the background color of the field to the given color 0075 void setBackgroundColor(const QColor&); 0076 0077 //! @return the foreground (text) color of the field 0078 QColor foregroundColor() const; 0079 0080 //! Sets the foreground (text) color of the field to the given color 0081 void setForegroundColor(const QColor&); 0082 0083 //! @return the opacity of the field 0084 int backgroundOpacity() const; 0085 0086 //! Sets the background opacity of the field 0087 //! Valid values are in the range 0-100 0088 void setBackgroundOpacity(int); 0089 0090 //! @return the border line color of the field 0091 QColor lineColor() const; 0092 0093 //! Sets the border line color of the field to the given color 0094 void setLineColor(const QColor&); 0095 0096 //! @return the border line weight (thickness) of the field 0097 int lineWeight() const; 0098 0099 //! Sets the border line weight (thickness) of the field 0100 void setLineWeight(int); 0101 0102 //! @return the border line style of the field. Values are from Qt::Penstyle range 0-5 0103 int lineStyle() const; 0104 0105 //! Sets the border line style of the field to the given style in the range 0-5 0106 void setLineStyle(int); 0107 0108 //! @returns the position of the field in points 0109 QPointF position() const; 0110 0111 //! Sets the position of the field to the given point coordinates 0112 void setPosition(const QPointF&); 0113 0114 //! @returns the size of the field in points 0115 QSizeF size() const; 0116 0117 //! Sets the size of the field to the given size in points 0118 void setSize(const QSizeF&); 0119 0120 private: 0121 KReportItemField *m_field; 0122 0123 }; 0124 } 0125 #endif