#include "KDChartLayoutItems.h"
#include "KDTextDocument.h"
#include "KDChartAbstractArea.h"
#include "KDChartAbstractDiagram.h"
#include "KDChartBackgroundAttributes.h"
#include "KDChartFrameAttributes.h"
#include "KDChartPaintContext.h"
#include "KDChartPainterSaver_p.h"
#include <QTextCursor>
#include <QTextBlockFormat>
#include <QTextDocumentFragment>
#include <QAbstractTextDocumentLayout>
#include <QLayout>
#include <QPainter>
#include <QDebug>
#include <QCoreApplication>
#include <QApplication>
#include <QStringList>
#include <QStyle>
#include <KDABLibFakes>
#include <math.h>
Include dependency graph for KDChartLayoutItems.cpp:
Go to the source code of this file.
Defines | |
#define | PI 3.141592653589793 |
Functions | |
static QPointF | rotatedPoint (const QPointF &pt, qreal rotation) |
static QRectF | rotatedRect (const QRectF &rect, qreal angle) |
static void | updateCommonBrush (QBrush &commonBrush, bool &bStart, const KDChart::AbstractArea &area) |
#define PI 3.141592653589793 |
Definition at line 50 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::intersects(), and rotatedPoint().
static QPointF rotatedPoint | ( | const QPointF & | pt, | |
qreal | rotation | |||
) | [static] |
Definition at line 361 of file KDChartLayoutItems.cpp.
References PI.
Referenced by rotatedRect().
00362 { 00363 const qreal angle = PI * rotation / 180.0; 00364 const qreal cosAngle = cos( angle ); 00365 const qreal sinAngle = sin( angle ); 00366 return QPointF( 00367 (cosAngle * pt.x() + sinAngle * pt.y() ), 00368 (cosAngle * pt.y() + sinAngle * pt.x() ) ); 00369 }
static QRectF rotatedRect | ( | const QRectF & | rect, | |
qreal | angle | |||
) | [static] |
Definition at line 371 of file KDChartLayoutItems.cpp.
References rotatedPoint().
Referenced by KDChart::TextLayoutItem::paint().
00372 { 00373 const QPointF topLeft( rotatedPoint( rect.topLeft(), angle ) ); 00374 //const QPointF topRight( rotatedPoint( rect.topRight(), angle ) ); 00375 //const QPointF bottomLeft( rotatedPoint( rect.bottomLeft(), angle ) ); 00376 //const QPointF bottomRight( rotatedPoint( rect.bottomRight(), angle ) ); 00377 const QPointF siz( rotatedPoint( QPointF( rect.size().width(), rect.size().height() ), angle ) ); 00378 const QRectF result( 00379 topLeft, 00380 QSizeF( siz.x(), //bottomRight.x() - topLeft.x(), 00381 siz.y() ) ); //bottomRight.y() - topLeft.y() ) ); 00382 //qDebug() << "angle" << angle << "\nbefore:" << rect << "\n after:" << result; 00383 return result; 00384 }
static void updateCommonBrush | ( | QBrush & | commonBrush, | |
bool & | bStart, | |||
const KDChart::AbstractArea & | area | |||
) | [static] |
Definition at line 802 of file KDChartLayoutItems.cpp.
References KDChart::AbstractAreaBase::backgroundAttributes(), KDChart::BackgroundAttributes::BackgroundPixmapModeNone, KDChart::AbstractAreaBase::frameAttributes(), and KDChart::FrameAttributes::isVisible().
Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().
00803 { 00804 const KDChart::BackgroundAttributes ba( area.backgroundAttributes() ); 00805 const bool hasSimpleBrush = ( 00806 ! area.frameAttributes().isVisible() && 00807 ba.isVisible() && 00808 ba.pixmapMode() == KDChart::BackgroundAttributes::BackgroundPixmapModeNone && 00809 ba.brush().gradient() == 0 ); 00810 if( bStart ){ 00811 bStart = false; 00812 commonBrush = hasSimpleBrush ? ba.brush() : QBrush(); 00813 }else{ 00814 if( ! hasSimpleBrush || ba.brush() != commonBrush ) 00815 { 00816 commonBrush = QBrush(); 00817 } 00818 } 00819 }