23 #ifndef KDCHARTLAYOUTITEMS_H
24 #define KDCHARTLAYOUTITEMS_H
28 #include <QFontMetricsF>
30 #include <QLayoutItem>
42 QRectF
rotatedRect(
const QRectF& pt, qreal rotation );
45 class AbstractDiagram;
66 virtual void paintAll( QPainter& painter );
68 virtual void paint( QPainter* ) = 0;
71 virtual void setParentWidget(
QWidget* widget );
72 virtual void sizeHintChanged()
const;
74 void setParentLayout( QLayout* lay )
78 QLayout* parentLayout()
82 void removeFromParentLayout()
84 if ( mParentLayout ) {
86 mParentLayout->removeWidget( widget() );
88 mParentLayout->removeItem(
this );
106 const QObject* autoReferenceArea,
108 Qt::Alignment alignment = 0 );
110 void setAutoReferenceArea(
const QObject* area );
111 const QObject* autoReferenceArea()
const;
113 void setText(
const QString & text);
114 QString text()
const;
116 void setTextAlignment( Qt::Alignment );
117 Qt::Alignment textAlignment()
const;
123 virtual bool isEmpty()
const;
125 virtual Qt::Orientations expandingDirections()
const;
127 virtual QSize maximumSize()
const;
129 virtual QSize minimumSize()
const;
131 virtual QSize sizeHint()
const;
133 virtual void setGeometry(
const QRect& r );
135 virtual QRect geometry()
const;
137 virtual int marginWidth()
const;
139 virtual QSize sizeHintUnrotated()
const;
141 virtual bool intersects(
const TextLayoutItem& other,
const QPointF& myPos,
const QPointF& otherPos )
const;
142 virtual bool intersects(
const TextLayoutItem& other,
const QPoint& myPos,
const QPoint& otherPos )
const;
144 virtual qreal realFontSize()
const;
145 virtual QFont realFont()
const;
147 virtual void paint( QPainter* );
149 QPolygon boundingPolygon()
const;
151 bool maybeUpdateRealFont()
const;
152 QSize unrotatedSizeHint(
const QFont& fnt = QFont() )
const;
153 QSize unrotatedTextSize( QFont fnt = QFont() )
const;
154 QSize calcSizeHint(
const QFont& font )
const;
155 int marginWidth(
const QSize& textSize )
const;
161 Qt::Alignment mTextAlignment;
163 const QObject* mAutoReferenceArea;
165 mutable QSize cachedSizeHint;
166 mutable QPolygon mCachedBoundingPolygon;
167 mutable qreal cachedFontSize;
168 mutable QFont cachedFont;
177 const QObject* autoReferenceArea,
179 Qt::Alignment alignment = 0 );
183 void setAutoReferenceArea(
const QObject* area );
184 const QObject* autoReferenceArea()
const;
186 void setText(
const QString & text);
187 QString text()
const;
193 virtual bool isEmpty()
const;
195 virtual Qt::Orientations expandingDirections()
const;
197 virtual QSize maximumSize()
const;
199 virtual QSize minimumSize()
const;
201 virtual QSize sizeHint()
const;
203 virtual void setGeometry(
const QRect& r );
205 virtual QRect geometry()
const;
207 virtual void paint( QPainter* painter );
210 int borderWidth()
const;
227 Qt::Alignment alignment = 0 );
229 virtual Qt::Orientations expandingDirections()
const;
230 virtual QRect geometry()
const;
231 virtual bool isEmpty()
const;
232 virtual QSize maximumSize()
const;
233 virtual QSize minimumSize()
const;
234 virtual void setGeometry(
const QRect& r );
235 virtual QSize sizeHint()
const;
237 virtual void paint( QPainter* );
239 static void paintIntoRect(
265 Qt::Alignment mLegendLineSymbolAlignment,
266 Qt::Alignment alignment = 0 );
268 virtual Qt::Orientations expandingDirections()
const;
269 virtual QRect geometry()
const;
270 virtual bool isEmpty()
const;
271 virtual QSize maximumSize()
const;
272 virtual QSize minimumSize()
const;
273 virtual void setGeometry(
const QRect& r );
274 virtual QSize sizeHint()
const;
276 void setLegendLineSymbolAlignment(Qt::Alignment legendLineSymbolAlignment);
277 virtual Qt::Alignment legendLineSymbolAlignment()
const;
279 virtual void paint( QPainter* );
281 static void paintIntoRect(
285 Qt::Alignment lineAlignment);
292 Qt::Alignment mLegendLineSymbolAlignment;
307 const QBrush& markerBrush,
308 const QPen& markerPen,
309 Qt::Alignment alignment = 0 );
311 virtual Qt::Orientations expandingDirections()
const;
312 virtual QRect geometry()
const;
313 virtual bool isEmpty()
const;
314 virtual QSize maximumSize()
const;
315 virtual QSize minimumSize()
const;
316 virtual void setGeometry(
const QRect& r );
317 virtual QSize sizeHint()
const;
319 virtual void paint( QPainter* );
342 virtual Qt::Orientations expandingDirections()
const;
343 virtual QRect geometry()
const;
344 virtual bool isEmpty()
const;
345 virtual QSize maximumSize()
const;
346 virtual QSize minimumSize()
const;
347 virtual void setGeometry(
const QRect& r );
348 virtual QSize sizeHint()
const;
350 virtual void paint( QPainter* );
365 virtual Qt::Orientations expandingDirections()
const;
366 virtual QRect geometry()
const;
367 virtual bool isEmpty()
const;
368 virtual QSize maximumSize()
const;
369 virtual QSize minimumSize()
const;
370 virtual void setGeometry(
const QRect& r );
371 virtual QSize sizeHint()
const;
373 virtual void paint( QPainter* );
453 bool layoutIsAtTopPosition, QHBoxLayout *rightLeftLayout,
454 bool layoutIsAtLeftPosition, QVBoxLayout *topBottomLayout );
456 virtual Qt::Orientations expandingDirections()
const;
457 virtual QRect geometry()
const;
458 virtual bool isEmpty()
const;
459 virtual QSize maximumSize()
const;
460 virtual QSize minimumSize()
const;
461 virtual void setGeometry(
const QRect& r );
462 virtual QSize sizeHint()
const;
464 virtual void paint( QPainter* );
468 bool mLayoutIsAtTopPosition;
469 QHBoxLayout *mRightLeftLayout;
470 bool mLayoutIsAtLeftPosition;
471 QVBoxLayout *mTopBottomLayout;
473 mutable QBrush mCommonBrush;
474 mutable QSize mCachedSize;