KGantt

kganttprintingcontext.cpp
1/*
2 * SPDX-FileCopyrightText: 2020 Dag Andersen <dag.andersen@kdemail.net>
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
11namespace KGantt
12{
13
14class Q_DECL_HIDDEN PrintingContext::Private {
15public:
16 PrintingContext::Fitting fitting;
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
87{
88 return d->sceneRect.left();
89}
90
92{
93 d->sceneRect.setLeft(left);
94}
95
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
129QDebug operator<<( QDebug dbg, const KGantt::PrintingContext::Fitting &f)
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
The PrintingContext class provides options for printing the gantt chart.
void setSceneRect(const QRectF &rect)
void setFitting(const Fitting &value)
@ FitSinglePage
Scale diagram to fit on a single page.
@ NoFitting
No scaling, print as many pages as needed.
@ FitPageHeight
Scale diagram height to fit one page.
PrintingContext & operator=(const PrintingContext &other)
Global namespace.
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
qreal bottom() const const
qreal left() const const
qreal right() const const
void setBottom(qreal y)
void setLeft(qreal x)
void setRight(qreal x)
void setTop(qreal y)
qreal top() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.