KChart

KChartFrameAttributes.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 "KChartFrameAttributes.h"
10
11#include "KChartMath_p.h"
12
13#define d d_func()
14
15using namespace KChart;
16
17class Q_DECL_HIDDEN FrameAttributes::Private
18{
19 friend class FrameAttributes;
20public:
21 Private();
22private:
23 bool visible;
24 QPen pen;
25 qreal cornerRadius;
26 int padding;
27};
28
29FrameAttributes::Private::Private() :
30 visible( false ),
31 cornerRadius( 0 ),
32 padding( 0 )
33{
34}
35
36
37FrameAttributes::FrameAttributes()
38 : _d( new Private() )
39{
40}
41
42FrameAttributes::FrameAttributes( const FrameAttributes& r )
43 : _d( new Private( *r.d ) )
44{
45}
46
47FrameAttributes & FrameAttributes::operator=( const FrameAttributes& r )
48{
49 if ( this == &r )
50 return *this;
51
52 *d = *r.d;
53
54 return *this;
55}
56
57FrameAttributes::~FrameAttributes()
58{
59 delete _d; _d = nullptr;
60}
61
62
63bool FrameAttributes::operator==( const FrameAttributes& r ) const
64{
65 return ( isVisible() == r.isVisible() &&
66 pen() == r.pen() &&
67 cornerRadius() == r.cornerRadius() &&
68 padding() == r.padding() );
69}
70
71
72
73
74void FrameAttributes::setVisible( bool visible )
75{
76 d->visible = visible;
77}
78
79bool FrameAttributes::isVisible() const
80{
81 return d->visible;
82}
83
84void FrameAttributes::setPen( const QPen & pen )
85{
86 d->pen = pen;
87}
88
89QPen FrameAttributes::pen() const
90{
91 return d->pen;
92}
93
94void FrameAttributes::setCornerRadius(qreal radius)
95{
96 d->cornerRadius = radius;
97}
98
99qreal FrameAttributes::cornerRadius() const
100{
101 return d->cornerRadius;
102}
103
104void FrameAttributes::setPadding( int padding )
105{
106 d->padding = padding;
107}
108
109int FrameAttributes::padding() const
110{
111 return d->padding;
112}
113
114#if !defined(QT_NO_DEBUG_STREAM)
116{
117 dbg << "KChart::FrameAttributes("
118 << "visible="<<fa.isVisible()
119 << "pen="<<fa.pen()
120 << "cornerRadius="<<fa.cornerRadius()
121 << "padding="<<fa.padding()
122 << ")";
123 return dbg;
124}
125#endif /* QT_NO_DEBUG_STREAM */
A set of attributes for frames around items.
KTEXTEDITOR_EXPORT QDebug operator<<(QDebug s, const MovingCursor &cursor)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:18:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.