File indexing completed on 2024-04-28 04:42:09
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 #ifndef KREPORTDESIGNERITEMLINE_H 0020 #define KREPORTDESIGNERITEMLINE_H 0021 0022 #include "KReportDesignerItemBase.h" 0023 #include "KReportItemLine.h" 0024 0025 #include <QGraphicsLineItem> 0026 0027 class KReportDesigner; 0028 class KPropertySet; 0029 0030 class KReportDesignerItemLine : public KReportItemLine, public QGraphicsLineItem, public KReportDesignerItemBase 0031 { 0032 Q_OBJECT 0033 public: 0034 KReportDesignerItemLine(KReportDesigner *d, QGraphicsScene *scene, const QPointF &pos); 0035 KReportDesignerItemLine(KReportDesigner *d, QGraphicsScene *scene, const QPointF &startPos, 0036 const QPointF &endPos); 0037 KReportDesignerItemLine(const QDomNode &element, KReportDesigner *d, QGraphicsScene *scene); 0038 ~KReportDesignerItemLine() override; 0039 0040 void buildXML(QDomDocument *doc, QDomElement *parent) override; 0041 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 0042 QWidget *widget = nullptr) override; 0043 KReportDesignerItemLine *clone() override; 0044 0045 void setLineScene(const QLineF &line); 0046 0047 void move(const QPointF &m) override; 0048 0049 private: 0050 KReportDesigner* m_rd; 0051 void init(QGraphicsScene *s, KReportDesigner *r); 0052 int grabHandle(const QPointF &pos); 0053 0054 int m_grabAction; 0055 0056 protected: 0057 void hoverMoveEvent(QGraphicsSceneHoverEvent * event) override; 0058 void mouseMoveEvent(QGraphicsSceneMouseEvent * event) override; 0059 void mousePressEvent(QGraphicsSceneMouseEvent * event) override; 0060 void mouseReleaseEvent(QGraphicsSceneMouseEvent * event) override; 0061 QVariant itemChange(GraphicsItemChange change, const QVariant &value) override; 0062 void propertyChanged(KPropertySet &s, KProperty &p) override; 0063 }; 0064 0065 #endif