labplot  2.8.2
About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.
  Fossies Dox: labplot-2.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

CustomPointPrivate.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : CustomPointPrivate.h
3  Project : LabPlot
4  Description : Custom user-defined point on the plot
5  --------------------------------------------------------------------
6  Copyright : (C) 2015 Ankit Wagadre (wagadre.ankit@gmail.com)
7  Copyright : (C) 2015 Alexander Semke (alexander.semke@web.de)
8  ***************************************************************************/
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  * This program is distributed in the hope that it will be useful, *
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19  * GNU General Public License for more details. *
20  * *
21  * You should have received a copy of the GNU General Public License *
22  * along with this program; if not, write to the Free Software *
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
24  * Boston, MA 02110-1301 USA *
25  * *
26  ***************************************************************************/
27 
28 
29 #ifndef CUSTOMPOINTPRIVATE_H
30 #define CUSTOMPOINTPRIVATE_H
31 
32 #include <QGraphicsItem>
33 
34 class CustomPointPrivate: public QGraphicsItem {
35 public:
36  explicit CustomPointPrivate(CustomPoint*, const CartesianPlot*);
37 
39 
40  QString name() const;
41  void retransform();
42  bool swapVisible(bool);
43  virtual void recalcShapeAndBoundingRect();
45  void updateData();
46 
48  bool suppressRetransform{false};
49  bool m_printing{false};
50  bool m_hovered{false};
51  bool m_visible{true}; //point inside the plot (visible) or not
52 
55  QPainterPath pointShape;
56 
57  QPointF position; //position in plot coordinates
58  QPointF positionScene; //position in scene coordinates
59 
60  //symbol
62  QBrush symbolBrush;
63  QPen symbolPen;
66  qreal symbolSize;
67 
68  //reimplemented from QGraphicsItem
69  QRectF boundingRect() const override;
70  QPainterPath shape() const override;
71  void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget* widget = nullptr) override;
72  QVariant itemChange(GraphicsItemChange change, const QVariant& value) override;
73 
74  CustomPoint* const q;
75 
76 private:
77  void contextMenuEvent(QGraphicsSceneContextMenuEvent*) override;
78  void mouseReleaseEvent(QGraphicsSceneMouseEvent*) override;
79  void hoverEnterEvent(QGraphicsSceneHoverEvent*) override;
80  void hoverLeaveEvent(QGraphicsSceneHoverEvent*) override;
81 };
82 
83 #endif
A xy-plot.
Definition: CartesianPlot.h:58
void contextMenuEvent(QGraphicsSceneContextMenuEvent *) override
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *widget=nullptr) override
void hoverLeaveEvent(QGraphicsSceneHoverEvent *) override
Symbol::Style symbolStyle
virtual void recalcShapeAndBoundingRect()
CustomPointPrivate(CustomPoint *, const CartesianPlot *)
bool swapVisible(bool)
const CartesianPlot * plot
QRectF boundingRect() const override
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override
void hoverEnterEvent(QGraphicsSceneHoverEvent *) override
CustomPoint *const q
QPainterPath shape() const override
QString name() const
A customizable point.
Definition: CustomPoint.h:41
Style
Definition: Symbol.h:38