KReport

KReportDesignerSectionScene.h
1 /* This file is part of the KDE project
2  * Copyright (C) 2001-2007 by OpenMFG, LLC ([email protected])
3  * Copyright (C) 2007-2008 by Adam Pigg ([email protected])
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 //
20 // Class ReportCanvas
21 //
22 // Overrides the drawForeground() method to do the grid.
23 //
24 
25 #ifndef KREPORTDESIGNERSECTIONSCENE_H
26 #define KREPORTDESIGNERSECTIONSCENE_H
27 
28 #include <QGraphicsScene>
29 
30 #include "KReportUnit.h"
31 
33 class KReportDesigner;
37 
38 class KReportDesignerSectionScene : public QGraphicsScene
39 {
40  Q_OBJECT
41 public:
42  KReportDesignerSectionScene(qreal w, qreal h, KReportDesigner* rd);
43  ~KReportDesignerSectionScene() override;
44  KReportDesigner* document() const {
45  return m_rd;
46  }
47  QPointF gridPoint(const QPointF&);
48  void raiseSelected();
49  void lowerSelected();
50  QGraphicsItemList itemsOrdered() const;
51  qreal gridSize() const {
52  return m_pixelIncrementX;
53  }
54 
55 protected:
56  void drawBackground(QPainter *painter, const QRectF &clip) override;
57  void mousePressEvent(QGraphicsSceneMouseEvent *e) override;
58  void focusOutEvent(QFocusEvent *focusEvent) override;
59  void contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent) override;
60 
61 Q_SIGNALS:
62  void clicked();
63  void lostFocus();
64 
65 private:
66  qreal lowestZValue();
67  qreal highestZValue();
68  void exitInlineEditingModeInItems(KReportDesignerItemRectBase *rectUnderCursor);
69 
70  KReportDesigner * m_rd;
71 
72  KReportUnit m_unit;
73  qreal m_majorX = 0.0;
74  qreal m_majorY = 0.0;
75  qreal m_pixelIncrementX = 0.0;
76  qreal m_pixelIncrementY = 0.0;
77  int m_dpiX;
78  int m_dpiY;
79 };
80 
81 #endif
Q_OBJECTQ_OBJECT
Converts between different units.
Definition: KReportUnit.h:70
virtual void focusOutEvent(QFocusEvent *focusEvent)
virtual void drawBackground(QPainter *painter, const QRectF &rect)
Q_SIGNALSQ_SIGNALS
virtual void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
Base class for rectangular report items used within the designer GUI.
The ReportDesigner is the main widget for designing a report.
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:17:37 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.