KChart

KChartTextArea.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 "KChartTextArea.h"
10#include "KChartTextArea_p.h"
11
12#include "KChartMath_p.h"
13
14#include <qglobal.h>
15
16#include <QPainter>
17#include <QRect>
18
19
20using namespace KChart;
21
22TextArea::Private::Private() :
23 AbstractAreaBase::Private()
24{
25 // this block left empty intentionally
26}
27
28
29TextArea::Private::~Private()
30{
31 // this block left empty intentionally
32}
33
34
35TextArea::TextArea()
36 : QObject()
39{
40 // this block left empty intentionally
41}
42
43TextArea::~TextArea()
44{
45 // this block left empty intentionally
46}
47
48
49void TextArea::init()
50{
51 // this block left empty intentionally
52}
53
54void TextArea::paintIntoRect( QPainter& painter, const QRect& rect )
55{
56 const QRect oldGeometry( geometry() );
57 if ( oldGeometry != rect )
58 setGeometry( rect );
59 painter.translate( rect.left(), rect.top() );
60 paintAll( painter );
61 painter.translate( -rect.left(), -rect.top() );
62 if ( oldGeometry != rect )
64}
65
67{
68 // Paint the background and frame
69 paintBackground( painter, geometry() );
70 paintFrame( painter, geometry() );
71
72 // temporarily adjust the widget size, to be sure all content gets calculated
73 // to fit into the inner rectangle
76 inner.moveTo(
77 oldGeometry.left() + inner.left(),
78 oldGeometry.top() + inner.top() );
79 const bool needAdjustGeometry = oldGeometry != inner;
82 paint( &painter );
85 //qDebug() << "TextAreaWidget::paintAll() done.";
86}
87
89{
90 return geometry();
91}
92
94{
95 Q_EMIT positionChanged( this );
96}
97
Base class for AbstractArea and AbstractAreaWidget: An area in the chart with a background,...
virtual void paintIntoRect(QPainter &painter, const QRect &rect)
Draws the background and frame, then calls paint().
QRect areaGeometry() const override
void positionHasChanged() override
void paintAll(QPainter &painter) override
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invo...
Layout item showing a text.
QRect geometry() const override
pure virtual in QLayoutItem
void setGeometry(const QRect &r) override
pure virtual in QLayoutItem
Q_EMITQ_EMIT
T qobject_cast(QObject *object)
void translate(const QPoint &offset)
int left() const const
int top() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:24 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.