KChart

KChartPrintingParameters.cpp
1/*
2 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3 *
4 * This file is part of the KD Chart library.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#include "KChartPrintingParameters.h"
10
11using namespace KChart;
12
13PrintingParameters::PrintingParameters()
14 : m_scaleFactor( 1.0 )
15{
16}
17
18PrintingParameters* PrintingParameters::instance()
19{
20 static PrintingParameters instance;
21 return &instance;
22}
23
24qreal PrintingParameters::scaleFactor()
25{
26 return instance()->m_scaleFactor;
27}
28
29void PrintingParameters::setScaleFactor( const qreal scaleFactor )
30{
31 instance()->m_scaleFactor = scaleFactor;
32}
33
34void PrintingParameters::resetScaleFactor()
35{
36 instance()->m_scaleFactor = 1.0;
37}
38
39QPen PrintingParameters::scalePen( const QPen& pen )
40{
41 if ( instance()->m_scaleFactor == 1.0 )
42 return pen;
43
44 QPen resultPen = pen;
45 resultPen.setWidthF( resultPen.widthF() * instance()->m_scaleFactor );
46 if ( resultPen.widthF() == 0.0 )
47 resultPen.setWidthF( instance()->m_scaleFactor );
48
49 return resultPen;
50}
PrintingParameters stores the scale factor which lines has to been scaled with when printing.
void setWidthF(qreal width)
qreal widthF() 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:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.