"Fossies" - the Fresh Open Source Software Archive

Member "labplot-2.8.2/src/backend/worksheet/plots/cartesian/ReferenceLine.h" (24 Feb 2021, 3886 Bytes) of package /linux/privat/labplot-2.8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ReferenceLine.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.8.1_vs_2.8.2.

    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"
   33 #include "backend/worksheet/WorksheetElement.h"
   34 
   35 class ReferenceLinePrivate;
   36 class CartesianPlot;
   37 class QActionGroup;
   38 
   39 class ReferenceLine : public WorksheetElement {
   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)
   54     BASIC_D_ACCESSOR_DECL(Orientation, orientation, Orientation)
   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 
   65     typedef ReferenceLinePrivate Private;
   66 
   67 protected:
   68     ReferenceLinePrivate* const d_ptr;
   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:
   97     friend class ReferenceLineSetPositionCmd;
   98     void orientationChanged(Orientation);
   99     void positionChanged(double);
  100     void penChanged(const QPen&);
  101     void opacityChanged(qreal);
  102     void visibleChanged(bool);
  103 };
  104 
  105 #endif