KGantt

kganttprintingcontext.h
1 /*
2  * SPDX-FileCopyrightText: 2020 Dag Andersen <[email protected]>
3  *
4  * This file is part of the KGantt library.
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef KGANTTPRINTINGCONTEXT_H
10 #define KGANTTPRINTINGCONTEXT_H
11 
12 #include "kganttglobal.h"
13 
14 #include <QRectF>
15 
16 class QPainter;
17 class QPrinter;
18 
19 namespace KGantt
20 {
21  /*!\class KGantt::PrintingContext kganttprintingcontext.h KGanttPrintingContext
22  * \ingroup KGantt
23  * \brief The PrintingContext class provides options for printing the gantt chart.
24  *
25  * \since 2.8.0
26  */
27  class KGANTT_EXPORT PrintingContext
28  {
29  public:
30  /*! Create a default context */
32  /*! Copy the \a other context into this */
33  PrintingContext(const PrintingContext &other);
34  /*! Copy the \a other context into this */
35  PrintingContext &operator=(const PrintingContext &other);
36  /*! Destroy this context */
37  ~PrintingContext();
38 
39  /*! \enum KGantt::PrintingContext::Fitting
40  * Specifies how the diagram shall be fitted
41  * to the printed pages.
42  */
43  enum Fitting {
44  NoFitting = 1, ///< No scaling, print as many pages as needed
45  FitSinglePage = 2, ///< Scale diagram to fit on a single page
46  FitPageHeight = 4 ///< Scale diagram height to fit one page
47  };
48 
49  /*! \return scene rect
50  */
51  QRectF sceneRect() const;
52 
53  /*! Set sceneRect to \a rect
54  * Setting a null() rect means the whole diagram (default).
55  */
56  void setSceneRect(const QRectF &rect);
57 
58  /*! \return print scaling
59  */
60  Fitting fitting() const;
61  /*! Set print scaling to \a value
62  */
63  void setFitting(const Fitting &value);
64 
65  /*! \return if the the row labels shall be printed
66  */
67  bool drawRowLabels() const;
68 
69  /*! Set if the row labels shall be printed to @p state
70  * The row labels are printed to the left of the chart.
71  */
72  void setDrawRowLabels(bool state);
73 
74  /*! \return if the the column labels shall be printed
75  */
76  bool drawColumnLabels() const;
77 
78  /*! Set if the column labels shall be printed to @p state.
79  */
80  void setDrawColumnLabels(bool state);
81 
82  /*! \return position in the diagram to start printing
83  */
84  qreal left() const;
85 
86  /*! Set left position to start printing to @p left
87  *
88  * The default is 0.0, meaning the left of the chart.
89  *
90  * To print a certain range of a chart with a DateTimeGrid, use
91  * qreal DateTimeGrid::mapFromDateTime( const QDateTime& dt) const
92  * to figure out the values for @p left.
93  */
94  void setLeft(qreal left);
95 
96  /*! \return top position in the diagram to start printing
97  */
98  qreal top() const;
99 
100  /*! Set the top position to start printing to @p top
101  */
102  void setTop(qreal top);
103 
104  /*! \return position in the diagram to end printing
105  */
106  qreal right() const;
107 
108  /*! Set right position to right printing to @p right
109  *
110  * The default is 0.0, meaning the right of the chart.
111  *
112  * To print a certain range of a chart with a DateTimeGrid, use
113  * qreal DateTimeGrid::mapFromDateTime( const QDateTime& dt) const
114  * to figure out the values for @p right.
115  */
116  void setRight(qreal right);
117 
118  /*! \return bottom position in the diagram to end printing
119  */
120  qreal bottom() const;
121 
122  /*! Set bottom position to end printing to @p right
123  */
124  void setBottom(qreal bottom);
125 
126  private:
127  class Private;
128  Private *d;
129  };
130 
131 } // namespace KGantt
132 
133 #ifndef QT_NO_DEBUG_STREAM
134 QDebug KGANTT_EXPORT operator<<( QDebug dbg, const KGantt::PrintingContext::Fitting &f);
135 QDebug KGANTT_EXPORT operator<<( QDebug dbg, const KGantt::PrintingContext &ctx);
136 #endif
137 
138 #endif
Global namespace.
The PrintingContext class provides options for printing the gantt chart.
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Contains KGantt macros.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 22:32:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.