KGantt

kganttprintingcontext.cpp
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 #include "kganttprintingcontext.h"
10 
11 namespace KGantt
12 {
13 
14 class Q_DECL_HIDDEN PrintingContext::Private {
15 public:
17  QRectF sceneRect;
18  bool drawRowLabels;
19  bool drawColumnLabels;
20 };
21 
23  : d(new Private())
24 {
25  d->fitting = NoFitting;
26  d->drawRowLabels= true;
27  d->drawColumnLabels = true;
28 }
29 
31  : d(new Private(*other.d))
32 {
33 }
34 
36 {
37  *d = *other.d;
38  return *this;
39 }
40 
42 {
43  delete d; d = nullptr;
44 }
45 
47 {
48  return d->sceneRect;
49 }
50 
52 {
53  d->sceneRect = rect;
54 }
55 
57 {
58  return d->fitting;
59 }
60 
62 {
63  d->fitting = value;
64 }
65 
67 {
68  return d->drawRowLabels;
69 }
70 
72 {
73  d->drawRowLabels = state;
74 }
75 
77 {
78  return d->drawColumnLabels;
79 }
80 
82 {
83  d->drawColumnLabels = state;
84 }
85 
86 qreal PrintingContext::left() const
87 {
88  return d->sceneRect.left();
89 }
90 
92 {
93  d->sceneRect.setLeft(left);
94 }
95 
96 qreal PrintingContext::top() const
97 {
98  return d->sceneRect.top();
99 }
100 
102 {
103  d->sceneRect.setTop(top);
104 }
105 
107 {
108  return d->sceneRect.right();
109 }
110 
112 {
113  d->sceneRect.setRight(right);
114 }
115 
117 {
118  return d->sceneRect.bottom();
119 }
120 
122 {
123  d->sceneRect.setBottom(bottom);
124 }
125 
126 }
127 
128 #ifndef QT_NO_DEBUG_STREAM
130 {
131  switch (f) {
132  case KGantt::PrintingContext::NoFitting: dbg << "Fitting::NoFitting"; break;
133  case KGantt::PrintingContext::FitSinglePage: dbg << "Fitting::FitSinglePage"; break;
134  case KGantt::PrintingContext::FitPageHeight: dbg << "Fitting::FitPageHeight"; break;
135  default: break;
136  }
137  return dbg;
138 }
140 {
141  dbg << "KGantt::PrintingContext[";
142  dbg << ctx.fitting();
143  dbg << "Rows:" << ctx.drawRowLabels();
144  dbg << "Cols:" << ctx.drawColumnLabels();
145  dbg << ctx.sceneRect();
146  dbg << ']';
147  return dbg;
148 }
149 #endif
Scale diagram to fit on a single page.
No scaling, print as many pages as needed.
void setFitting(const Fitting &value)
Scale diagram height to fit one page.
Global namespace.
void setSceneRect(const QRectF &rect)
void setDrawColumnLabels(bool state)
The PrintingContext class provides options for printing the gantt chart.
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
PrintingContext & operator=(const PrintingContext &other)
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.