KReport

KReportDesignerItemRectBase.h
1 /* This file is part of the KDE project
2 
3  * Copyright (C) 2001-2007 by OpenMFG, LLC ([email protected])
4  * Copyright (C) 2007-2008 by Adam Pigg ([email protected])
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef KREPORTDESIGNERITEMRECTBASE_H
21 #define KREPORTDESIGNERITEMRECTBASE_H
22 
23 #include <QGraphicsRectItem>
24 
25 #include "KReportDesignerItemBase.h"
26 #include "kreport_export.h"
27 
28 class KReportDesigner;
29 
30 class KPropertySet;
31 
32 const int KREPORT_ITEM_RECT_DEFAULT_WIDTH = 100;
33 const int KREPORT_ITEM_RECT_DEFAULT_HEIGHT = 100;
34 
35 /*!
36  * @brief Base class for rectangular report items used within the designer GUI.
37 */
39 {
40 public:
42 
43  ~KReportDesignerItemRectBase() override;
44 
45  QRectF pointRect() const;
46 
47  virtual void enterInlineEditingMode();
48  virtual void exitInlineEditingMode();
49 
50 protected:
51 
52  enum class SceneRectFlag {
53  UpdateProperty,
54  DontUpdateProperty
55  };
56 
57  void setSceneRect(const QPointF &topLeft, const QSizeF &size,
58  SceneRectFlag update = SceneRectFlag::UpdateProperty);
59  void setSceneRect(const QRectF &rect,
60  SceneRectFlag update = SceneRectFlag::UpdateProperty);
61 
62  void drawHandles(QPainter*);
63  QRectF sceneRect();
64  void mousePressEvent(QGraphicsSceneMouseEvent * event) override;
65  void mouseReleaseEvent(QGraphicsSceneMouseEvent * event) override;
66  void mouseMoveEvent(QGraphicsSceneMouseEvent * event) override;
67  void hoverMoveEvent(QGraphicsSceneHoverEvent * event) override;
68  QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
69 
70  void propertyChanged(const KPropertySet &s, const KProperty &p);
71 
72  void move(const QPointF&) override;
73  QRectF properRect(const KReportDesigner &d, qreal minWidth, qreal minHeight) const;
74  int dpiX() const;
75  int dpiY() const;
76 private:
77  Q_DISABLE_COPY(KReportDesignerItemRectBase)
78  int grabHandle(const QPointF &pos);
79  QPointF properPressPoint(const KReportDesigner &d) const;
80 
81  class Private;
82  Private * const d;
83 };
84 
85 #endif
Base class for items that are drawn syncronously.
virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event)
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Base class for rectangular report items used within the designer GUI.
The ReportDesigner is the main widget for designing a report.
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Base class for report items used within the designer GUI.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Sep 22 2023 04:10:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.