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)  

CustomPoint.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : CustomPoint.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 #ifndef CUSTOMPOINT_H
29 #define CUSTOMPOINT_H
30 
31 #include <QPen>
32 
33 #include "backend/lib/macros.h"
36 
37 class QBrush;
38 class CustomPointPrivate;
39 class CartesianPlot;
40 
41 class CustomPoint : public WorksheetElement {
42  Q_OBJECT
43 
44 public:
45  explicit CustomPoint(const CartesianPlot*, const QString&);
46  ~CustomPoint() override;
47 
48  QIcon icon() const override;
49  QMenu* createContextMenu() override;
50  QGraphicsItem* graphicsItem() const override;
51 
52  void save(QXmlStreamWriter*) const override;
53  bool load(XmlStreamReader*, bool preview) override;
54 
55  BASIC_D_ACCESSOR_DECL(QPointF, position, Position)
56  BASIC_D_ACCESSOR_DECL(Symbol::Style, symbolStyle, SymbolStyle)
57  BASIC_D_ACCESSOR_DECL(qreal, symbolOpacity, SymbolOpacity)
58  BASIC_D_ACCESSOR_DECL(qreal, symbolRotationAngle, SymbolRotationAngle)
59  BASIC_D_ACCESSOR_DECL(qreal, symbolSize, SymbolSize)
60  CLASS_D_ACCESSOR_DECL(QBrush, symbolBrush, SymbolBrush)
61  CLASS_D_ACCESSOR_DECL(QPen, symbolPen, SymbolPen)
62 
63  void setVisible(bool on) override;
64  bool isVisible() const override;
65  void setPrinting(bool) override;
66 
67  void retransform() override;
68  void handleResize(double horizontalRatio, double verticalRatio, bool pageResize) override;
69 
71 
72 private slots:
73  void visibilityChanged();
74 
75 protected:
77  CustomPoint(const QString& name, CustomPointPrivate* dd);
78 
79 private:
80  Q_DECLARE_PRIVATE(CustomPoint)
81  void init();
82  void initActions();
83 
84  QAction* visibilityAction;
85 
86 signals:
88  void positionChanged(const QPointF&);
89  void visibleChanged(bool);
90  void changed();
91 
93  void symbolSizeChanged(qreal);
95  void symbolOpacityChanged(qreal);
96  void symbolBrushChanged(QBrush);
97  void symbolPenChanged(const QPen&);
98 };
99 
100 #endif
QString name() const
A xy-plot.
Definition: CartesianPlot.h:58
A customizable point.
Definition: CustomPoint.h:41
void symbolOpacityChanged(qreal)
CustomPoint(const CartesianPlot *, const QString &)
Definition: CustomPoint.cpp:53
void setVisible(bool on) override
Show/hide the element.
void save(QXmlStreamWriter *) const override
Save as XML.
QAction * visibilityAction
Definition: CustomPoint.h:84
void setPrinting(bool) override
Switches the printing mode on/off.
void symbolPenChanged(const QPen &)
friend class CustomPointSetPositionCmd
Definition: CustomPoint.h:87
void visibleChanged(bool)
void symbolSizeChanged(qreal)
QIcon icon() const override
void handleResize(double horizontalRatio, double verticalRatio, bool pageResize) override
void visibilityChanged()
void symbolRotationAngleChanged(qreal)
void changed()
void positionChanged(const QPointF &)
QGraphicsItem * graphicsItem() const override
Return the graphics item representing this element.
QMenu * createContextMenu() override
Return a new context menu.
bool load(XmlStreamReader *, bool preview) override
Load from XML.
void retransform() override
Tell the element to newly transform its graphics item into its coordinate system.
void symbolBrushChanged(QBrush)
void initActions()
Definition: CustomPoint.cpp:91
bool isVisible() const override
Return whether the element is (at least) partially visible.
CustomPointPrivate Private
Definition: CustomPoint.h:70
CustomPointPrivate *const d_ptr
Definition: CustomPoint.h:76
void symbolStyleChanged(Symbol::Style)
~CustomPoint() override
Style
Definition: Symbol.h:38
Base class for all Worksheet children.
XML stream parser that supports errors as well as warnings. This class also adds line and column numb...
#define CLASS_D_ACCESSOR_DECL(type, method, Method)
Definition: macros.h:134
#define BASIC_D_ACCESSOR_DECL(type, method, Method)
Definition: macros.h:107