24 #include "KDChartAbstractArea_p.h" 31 #include <KDABLibFakes> 38 AbstractArea::Private::Private() :
45 AbstractArea::Private::~Private()
51 AbstractArea::AbstractArea()
65 void AbstractArea::init()
67 d->amountOfLeftOverlap = 0;
68 d->amountOfRightOverlap = 0;
69 d->amountOfTopOverlap = 0;
70 d->amountOfBottomOverlap = 0;
78 if ( ! doNotRecalculate )
80 return d->amountOfLeftOverlap;
86 if ( ! doNotRecalculate )
88 return d->amountOfRightOverlap;
94 if ( ! doNotRecalculate )
96 return d->amountOfTopOverlap;
102 if ( ! doNotRecalculate )
104 return d->amountOfBottomOverlap;
110 const QRect oldGeometry( geometry() );
111 if ( oldGeometry != rect )
113 painter.translate( rect.left(), rect.top() );
115 painter.translate( -rect.left(), -rect.top() );
116 if ( oldGeometry != rect )
117 setGeometry( oldGeometry );
123 const QRect overlappingArea( geometry().adjusted( -
d->amountOfLeftOverlap, -
d->amountOfTopOverlap,
124 d->amountOfRightOverlap,
d->amountOfBottomOverlap ) );
132 inner.moveTo( oldGeometry.left() + inner.left(), oldGeometry.top() + inner.top() );
133 const bool needAdjustGeometry = oldGeometry != inner;
134 if ( needAdjustGeometry ) {
136 bool prevSignalBlocked = signalsBlocked();
137 blockSignals(
true );
138 setGeometry( inner );
139 blockSignals( prevSignalBlocked );
142 if ( needAdjustGeometry ) {
143 bool prevSignalBlocked = signalsBlocked();
144 blockSignals(
true );
145 setGeometry( oldGeometry );
146 blockSignals( prevSignalBlocked );
void positionChanged(AbstractArea *)
virtual void paintFrame(QPainter &painter, const QRect &rectangle)
Base class for AbstractArea and AbstractAreaWidget: An area in the chart with a background, a frame, etc.
virtual int leftOverlap(bool doNotRecalculate=false) const
This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().
virtual void paintIntoRect(QPainter &painter, const QRect &rect)
Draws the background and frame, then calls paint().
virtual int bottomOverlap(bool doNotRecalculate=false) const
This is called at layout time by KDChart:AutoSpacerLayoutItem::sizeHint().
virtual void paintBackground(QPainter &painter, const QRect &rectangle)
virtual int rightOverlap(bool doNotRecalculate=false) const
This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().
void positionHasChanged() override
Base class for all layout items of KD Chart.
virtual void paint(QPainter *)=0
virtual int topOverlap(bool doNotRecalculate=false) const
This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().
Class only listed here to document inheritance of some KDChart classes.
void paintAll(QPainter &painter) override
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invo...
QRect areaGeometry() const override