File indexing completed on 2024-05-19 04:44:32

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
0003  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Lesser General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2.1 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013  * Lesser General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Lesser General Public
0016  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 
0020 #ifndef KREPORTDESIGNERITEMFIELD_H
0021 #define KREPORTDESIGNERITEMFIELD_H
0022 
0023 #include <QGraphicsRectItem>
0024 
0025 #include <KPropertySet>
0026 
0027 #include "KReportItemField.h"
0028 #include "KReportDesignerItemRectBase.h"
0029 
0030 class KReportDesignerItemField : public KReportItemField, public KReportDesignerItemRectBase
0031 {
0032   Q_OBJECT
0033 public:
0034     // Used when creating new basic field
0035     KReportDesignerItemField(KReportDesigner *designer, QGraphicsScene *scene, const QPointF &pos);
0036     // Used when loading from file
0037     KReportDesignerItemField(const QDomNode &element, KReportDesigner *designer,
0038                              QGraphicsScene *scene);
0039     ~KReportDesignerItemField() override;
0040     void buildXML(QDomDocument *doc, QDomElement *parent) override;
0041 
0042     void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget *widget = nullptr) override;
0043     KReportDesignerItemField* clone() override;
0044 
0045 private:
0046     void init(QGraphicsScene *scene);
0047     QRectF getTextRect() const;
0048 
0049 private Q_SLOTS:
0050     void slotPropertyChanged(KPropertySet &, KProperty &);
0051 };
0052 
0053 #endif