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)  

ReferenceLine.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ReferenceLine.h
3  Project : LabPlot
4  Description : Reference line on the plot
5  --------------------------------------------------------------------
6  Copyright : (C) 2020 Alexander Semke (alexander.semke@web.de)
7  ***************************************************************************/
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  * This program is distributed in the hope that it will be useful, *
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18  * GNU General Public License for more details. *
19  * *
20  * You should have received a copy of the GNU General Public License *
21  * along with this program; if not, write to the Free Software *
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
23  * Boston, MA 02110-1301 USA *
24  * *
25  ***************************************************************************/
26 
27 #ifndef REFERENCELINE_H
28 #define REFERENCELINE_H
29 
30 #include <QPen>
31 
32 #include "backend/lib/macros.h"
34 
36 class CartesianPlot;
37 class QActionGroup;
38 
40  Q_OBJECT
41 
42 public:
43  explicit ReferenceLine(const CartesianPlot*, const QString&);
44  ~ReferenceLine() override;
45 
46  QIcon icon() const override;
47  QMenu* createContextMenu() override;
48  QGraphicsItem* graphicsItem() const override;
49 
50  void save(QXmlStreamWriter*) const override;
51  bool load(XmlStreamReader*, bool preview) override;
52 
53  BASIC_D_ACCESSOR_DECL(double, position, Position)
55  CLASS_D_ACCESSOR_DECL(QPen, pen, Pen)
56  BASIC_D_ACCESSOR_DECL(qreal, opacity, Opacity)
57 
58  void setVisible(bool on) override;
59  bool isVisible() const override;
60  void setPrinting(bool) override;
61 
62  void retransform() override;
63  void handleResize(double horizontalRatio, double verticalRatio, bool pageResize) override;
64 
66 
67 protected:
69  ReferenceLine(const QString& name, ReferenceLinePrivate* dd);
70 
71 private:
72  Q_DECLARE_PRIVATE(ReferenceLine)
73  void init();
74  void initActions();
75  void initMenus();
76 
77  QAction* visibilityAction{nullptr};
78  QAction* orientationHorizontalAction{nullptr};
79  QAction* orientationVerticalAction{nullptr};
80 
81  QActionGroup* lineStyleActionGroup{nullptr};
82  QActionGroup* lineColorActionGroup{nullptr};
83 
84  QMenu* orientationMenu{nullptr};
85  QMenu* lineMenu{nullptr};
86  QMenu* lineStyleMenu{nullptr};
87  QMenu* lineColorMenu{nullptr};
88 
89 private slots:
90  //SLOTs for changes triggered via QActions in the context menu
91  void orientationChangedSlot(QAction*);
92  void lineStyleChanged(QAction*);
93  void lineColorChanged(QAction*);
94  void visibilityChangedSlot();
95 
96 signals:
99  void positionChanged(double);
100  void penChanged(const QPen&);
101  void opacityChanged(qreal);
102  void visibleChanged(bool);
103 };
104 
105 #endif
QString name() const
A xy-plot.
Definition: CartesianPlot.h:58
A customizable point.
Definition: ReferenceLine.h:39
~ReferenceLine() override
void visibleChanged(bool)
void handleResize(double horizontalRatio, double verticalRatio, bool pageResize) override
QMenu * createContextMenu() override
Return a new context menu.
QIcon icon() const override
void save(QXmlStreamWriter *) const override
Save as XML.
bool load(XmlStreamReader *, bool preview) override
Load from XML.
ReferenceLinePrivate *const d_ptr
Definition: ReferenceLine.h:68
void visibilityChangedSlot()
void penChanged(const QPen &)
QActionGroup * lineStyleActionGroup
Definition: ReferenceLine.h:81
void orientationChangedSlot(QAction *)
void setVisible(bool on) override
Show/hide the element.
bool isVisible() const override
Return whether the element is (at least) partially visible.
void lineStyleChanged(QAction *)
void lineColorChanged(QAction *)
void orientationChanged(Orientation)
void setPrinting(bool) override
Switches the printing mode on/off.
ReferenceLinePrivate Private
Definition: ReferenceLine.h:65
void opacityChanged(qreal)
QMenu * lineColorMenu
Definition: ReferenceLine.h:87
friend class ReferenceLineSetPositionCmd
Definition: ReferenceLine.h:97
QAction * orientationVerticalAction
Definition: ReferenceLine.h:79
ReferenceLine(const CartesianPlot *, const QString &)
QGraphicsItem * graphicsItem() const override
Return the graphics item representing this element.
void positionChanged(double)
QMenu * lineMenu
Definition: ReferenceLine.h:85
QActionGroup * lineColorActionGroup
Definition: ReferenceLine.h:82
QAction * orientationHorizontalAction
Definition: ReferenceLine.h:78
QMenu * lineStyleMenu
Definition: ReferenceLine.h:86
void retransform() override
Tell the element to newly transform its graphics item into its coordinate system.
QMenu * orientationMenu
Definition: ReferenceLine.h:84
QAction * visibilityAction
Definition: ReferenceLine.h:77
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