KDChart::TextArea Class Reference

#include <KDChartTextArea.h>

Inheritance diagram for KDChart::TextArea:

Inheritance graph
[legend]
Collaboration diagram for KDChart::TextArea:

Collaboration graph
[legend]
List of all members.

Detailed Description

A text area in the chart with a background, a frame, etc.

TextArea is the base class for all text containing non-widget chart elements that have a set of background attributes and frame attributes, such as headers or footers.

Note:
This class inherits from AbstractAreaBase, TextLayoutItem, QObject. The reason for this tripple inheritance is that neither AbstractAreaBase nor TextLayoutItem are QObject.

Definition at line 54 of file KDChartTextArea.h.

Signals

void positionChanged (TextArea *)

Public Member Functions

void alignToReferencePoint (const RelativePosition &position)
const QObjectautoReferenceArea () const
BackgroundAttributes backgroundAttributes () const
bool compare (const AbstractAreaBase *other) const
 Returns true if both areas have the same settings.
virtual Qt::Orientations expandingDirections () const
 pure virtual in QLayoutItem
FrameAttributes frameAttributes () const
virtual QRect geometry () const
 pure virtual in QLayoutItem
void getFrameLeadings (int &left, int &top, int &right, int &bottom) const
virtual bool intersects (const TextLayoutItem &other, const QPoint &myPos, const QPoint &otherPos) const
virtual bool intersects (const TextLayoutItem &other, const QPointF &myPos, const QPointF &otherPos) const
virtual bool isEmpty () const
 pure virtual in QLayoutItem
virtual QSize maximumSize () const
 pure virtual in QLayoutItem
virtual QSize minimumSize () const
 pure virtual in QLayoutItem
virtual void paint (QPainter *)
void paintAll (QPainter &painter)
 Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked automatically.
virtual void paintBackground (QPainter &painter, const QRect &rectangle)
virtual void paintCtx (PaintContext *context)
 Default impl: Paint the complete item using its layouted position and size.
virtual void paintFrame (QPainter &painter, const QRect &rectangle)
virtual void paintIntoRect (QPainter &painter, const QRect &rect)
 Draws the background and frame, then calls paint().
QLayout * parentLayout ()
virtual QFont realFont () const
virtual qreal realFontSize () const
void removeFromParentLayout ()
void setAutoReferenceArea (const QObject *area)
void setBackgroundAttributes (const BackgroundAttributes &a)
void setFrameAttributes (const FrameAttributes &a)
virtual void setGeometry (const QRect &r)
 pure virtual in QLayoutItem
void setParentLayout (QLayout *lay)
virtual void setParentWidget (QWidget *widget)
 Inform the item about its widget: This enables the item, to trigger that widget's update, whenever the size of the item's contents has changed.
void setText (const QString &text)
void setTextAttributes (const TextAttributes &a)
 Use this to specify the text attributes to be used for this item.
virtual QSize sizeHint () const
 pure virtual in QLayoutItem
virtual void sizeHintChanged () const
 Report changed size hint: ask the parent widget to recalculate the layout.
QString text () const
TextAttributes textAttributes () const
 Returns the text attributes to be used for this item.
virtual ~TextArea ()

Static Public Member Functions

static void paintBackgroundAttributes (QPainter &painter, const QRect &rectangle, const KDChart::BackgroundAttributes &attributes)
static void paintFrameAttributes (QPainter &painter, const QRect &rectangle, const KDChart::FrameAttributes &attributes)

Protected Member Functions

virtual QRect areaGeometry () const
QRect innerRect () const
virtual void positionHasChanged ()
 TextArea ()

Protected Attributes

QWidgetmParent
QLayout * mParentLayout


Constructor & Destructor Documentation

TextArea::~TextArea (  )  [virtual]

Definition at line 60 of file KDChartTextArea.cpp.

00061 {
00062     // this bloc left empty intentionally
00063 }

TextArea::TextArea (  )  [protected]

Definition at line 52 of file KDChartTextArea.cpp.

00053     : QObject()
00054     , KDChart::AbstractAreaBase()
00055     , KDChart::TextLayoutItem()
00056 {
00057     // this bloc left empty intentionally
00058 }


Member Function Documentation

void AbstractAreaBase::alignToReferencePoint ( const RelativePosition position  )  [inherited]

Definition at line 90 of file KDChartAbstractAreaBase.cpp.

00091 {
00092     Q_UNUSED( position );
00093     // PENDING(kalle) FIXME
00094     qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosition& position )" );
00095 }

QRect TextArea::areaGeometry (  )  const [protected, virtual]

Implements KDChart::AbstractAreaBase.

Definition at line 105 of file KDChartTextArea.cpp.

References KDChart::TextLayoutItem::geometry().

Referenced by paintAll().

00106 {
00107     return geometry();
00108 }

const QObject * KDChart::TextLayoutItem::autoReferenceArea (  )  const [inherited]

Definition at line 135 of file KDChartLayoutItems.cpp.

Referenced by KDChart::HeaderFooter::compare(), and KDChart::HeaderFooter::setParent().

00136 {
00137     return mAutoReferenceArea;
00138 }

BackgroundAttributes AbstractAreaBase::backgroundAttributes (  )  const [inherited]

Definition at line 120 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by KDChart::AbstractAreaBase::compare(), and updateCommonBrush().

00121 {
00122     return d->backgroundAttributes;
00123 }

bool AbstractAreaBase::compare ( const AbstractAreaBase other  )  const [inherited]

Returns true if both areas have the same settings.

Definition at line 75 of file KDChartAbstractAreaBase.cpp.

References KDChart::AbstractAreaBase::backgroundAttributes(), and KDChart::AbstractAreaBase::frameAttributes().

00076 {
00077     if( other == this ) return true;
00078     if( ! other ){
00079         //qDebug() << "CartesianAxis::compare() cannot compare to Null pointer";
00080         return false;
00081     }
00082     /*
00083     qDebug() << "AbstractAreaBase:" << (frameAttributes() == other->frameAttributes())
00084         << (backgroundAttributes() == other->backgroundAttributes()) << "\n";
00085     */
00086     return  (frameAttributes()      == other->frameAttributes()) &&
00087             (backgroundAttributes() == other->backgroundAttributes());
00088 }

Qt::Orientations KDChart::TextLayoutItem::expandingDirections (  )  const [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 179 of file KDChartLayoutItems.cpp.

00180 {
00181     return 0; // Grow neither vertically nor horizontally
00182 }

FrameAttributes AbstractAreaBase::frameAttributes (  )  const [inherited]

Definition at line 106 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by KDChart::Legend::clone(), KDChart::AbstractAreaBase::compare(), and updateCommonBrush().

00107 {
00108     return d->frameAttributes;
00109 }

QRect KDChart::TextLayoutItem::geometry (  )  const [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 184 of file KDChartLayoutItems.cpp.

Referenced by areaGeometry(), KDChart::TextLayoutItem::paint(), paintAll(), KDChart::CartesianAxis::paintCtx(), and paintIntoRect().

00185 {
00186     return mRect;
00187 }

void AbstractAreaBase::getFrameLeadings ( int &  left,
int &  top,
int &  right,
int &  bottom 
) const [inherited]

Definition at line 212 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by KDChart::AbstractAreaBase::innerRect(), and KDChart::AbstractAreaWidget::paintAll().

00213 {
00214     if( d && d->frameAttributes.isVisible() ){
00215         const int padding = qMax( d->frameAttributes.padding(), 0 );
00216         left   = padding;
00217         top    = padding;
00218         right  = padding;
00219         bottom = padding;
00220     }else{
00221         left   = 0;
00222         top    = 0;
00223         right  = 0;
00224         bottom = 0;
00225     }
00226 }

QRect AbstractAreaBase::innerRect (  )  const [protected, inherited]

Definition at line 228 of file KDChartAbstractAreaBase.cpp.

References KDChart::AbstractAreaBase::areaGeometry(), and KDChart::AbstractAreaBase::getFrameLeadings().

Referenced by paintAll(), and KDChart::AbstractArea::paintAll().

00229 {
00230     int left;
00231     int top;
00232     int right;
00233     int bottom;
00234     getFrameLeadings( left, top, right, bottom );
00235     return
00236         QRect( QPoint(0,0), areaGeometry().size() )
00237             .adjusted( left, top, -right, -bottom );
00238 }

bool KDChart::TextLayoutItem::intersects ( const TextLayoutItem other,
const QPoint &  myPos,
const QPoint &  otherPos 
) const [virtual, inherited]

Definition at line 258 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::mAttributes, PI, KDChart::TextLayoutItem::rotatedCorners(), KDChart::TextAttributes::rotation(), and KDChart::TextLayoutItem::unrotatedSizeHint().

00259 {
00260     if ( mAttributes.rotation() != other.mAttributes.rotation() )
00261     {
00262         // that's the code for the common case: the rotation angles don't need to match here
00263         QPolygon myPolygon(          rotatedCorners() );
00264         QPolygon otherPolygon( other.rotatedCorners() );
00265 
00266         // move the polygons to their positions
00267         myPolygon.translate( myPos );
00268         otherPolygon.translate( otherPos );
00269 
00270         // create regions out of it
00271         QRegion myRegion( myPolygon );
00272         QRegion otherRegion( otherPolygon );
00273 
00274         // now the question - do they intersect or not?
00275         return ! myRegion.intersect( otherRegion ).isEmpty();
00276 
00277     } else {
00278         // and that's the code for the special case: the rotation angles match, which is less time consuming in calculation
00279         const qreal angle = mAttributes.rotation() * PI / 180.0;
00280         // both sizes
00281         const QSizeF mySize(          unrotatedSizeHint() );
00282         const QSizeF otherSize( other.unrotatedSizeHint() );
00283 
00284         // that's myP1 relative to myPos
00285         QPointF myP1( mySize.height() * sin( angle ), 0.0 );
00286         // that's otherP1 to myPos
00287         QPointF otherP1 = QPointF( otherSize.height() * sin( angle ), 0.0 ) + otherPos - myPos;
00288 
00289         // now rotate both points the negative angle around myPos
00290         myP1 = QPointF( myP1.x() * cos( -angle ), myP1.x() * sin( -angle ) );
00291         qreal r = sqrt( otherP1.x() * otherP1.x() + otherP1.y() * otherP1.y() );
00292         otherP1 = QPointF( r * cos( -angle ), r * sin( -angle ) );
00293 
00294         // finally we look, whether both rectangles intersect or even not
00295         return QRectF( myP1, mySize ).intersects( QRectF( otherP1, otherSize ) );
00296     }
00297 }

bool KDChart::TextLayoutItem::intersects ( const TextLayoutItem other,
const QPointF &  myPos,
const QPointF &  otherPos 
) const [virtual, inherited]

Definition at line 253 of file KDChartLayoutItems.cpp.

Referenced by KDChart::CartesianAxis::paintCtx().

00254 {
00255     return intersects( other, myPos.toPoint(), otherPos.toPoint() );
00256 }

bool KDChart::TextLayoutItem::isEmpty (  )  const [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 189 of file KDChartLayoutItems.cpp.

00190 {
00191     return false; // never empty, otherwise the layout item would not exist
00192 }

QSize KDChart::TextLayoutItem::maximumSize (  )  const [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 194 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::sizeHint().

00195 {
00196     return sizeHint(); // PENDING(kalle) Review, quite inflexible
00197 }

QSize KDChart::TextLayoutItem::minimumSize (  )  const [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 199 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::sizeHint().

00200 {
00201     return sizeHint(); // PENDING(kalle) Review, quite inflexible
00202 }

void KDChart::TextLayoutItem::paint ( QPainter *   )  [virtual, inherited]

Implements KDChart::AbstractLayoutItem.

Definition at line 386 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::geometry(), KDChart::TextAttributes::pen(), rotatedRect(), and KDChart::TextAttributes::rotation().

Referenced by paintAll(), and KDChart::CartesianAxis::paintCtx().

00387 {
00388     // make sure, cached font is updated, if needed:
00389     // sizeHint();
00390 
00391     if( !mRect.isValid() )
00392         return;
00393 
00394     PainterSaver painterSaver( painter );
00395     painter->setFont( cachedFont );
00396     QRectF rect( geometry() );
00397 
00398 // #ifdef DEBUG_ITEMS_PAINT
00399 //     painter->setPen( Qt::black );
00400 //     painter->drawRect( rect );
00401 // #endif
00402     painter->translate( rect.center() );
00403     rect.moveTopLeft( QPointF( - rect.width() / 2, - rect.height() / 2 ) );
00404 #ifdef DEBUG_ITEMS_PAINT
00405     painter->setPen( Qt::blue );
00406     painter->drawRect( rect );
00407 #endif
00408     painter->rotate( mAttributes.rotation() );
00409     rect = rotatedRect( rect, mAttributes.rotation() );
00410 #ifdef DEBUG_ITEMS_PAINT
00411     painter->setPen( Qt::red );
00412     painter->drawRect( rect );
00413 #endif
00414     painter->setPen( mAttributes.pen() );
00415     painter->drawText( rect, Qt::AlignHCenter | Qt::AlignVCenter, mText );
00416 //    if (  calcSizeHint( cachedFont ).width() > rect.width() )
00417 //        qDebug() << "rect.width()" << rect.width() << "text.width()" << calcSizeHint( cachedFont ).width();
00418 //
00419 //    //painter->drawText( rect, Qt::AlignHCenter | Qt::AlignVCenter, mText );
00420 }

void TextArea::paintAll ( QPainter &  painter  )  [virtual]

Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked automatically.

Reimplemented from KDChart::AbstractLayoutItem.

Definition at line 83 of file KDChartTextArea.cpp.

References areaGeometry(), KDChart::TextLayoutItem::geometry(), KDChart::AbstractAreaBase::innerRect(), KDChart::TextLayoutItem::paint(), KDChart::AbstractAreaBase::paintBackground(), KDChart::AbstractAreaBase::paintFrame(), and KDChart::TextLayoutItem::setGeometry().

Referenced by paintIntoRect().

00084 {
00085     // Paint the background and frame
00086     paintBackground( painter, geometry() );
00087     paintFrame(      painter, geometry() );
00088 
00089     // temporarily adjust the widget size, to be sure all content gets calculated
00090     // to fit into the inner rectangle
00091     const QRect oldGeometry( areaGeometry()  );
00092     QRect inner( innerRect() );
00093     inner.moveTo(
00094         oldGeometry.left() + inner.left(),
00095         oldGeometry.top()  + inner.top() );
00096     const bool needAdjustGeometry = oldGeometry != inner;
00097     if( needAdjustGeometry )
00098         setGeometry( inner );
00099     paint( &painter );
00100     if( needAdjustGeometry )
00101         setGeometry( oldGeometry );
00102     //qDebug() << "TextAreaWidget::paintAll() done.";
00103 }

void AbstractAreaBase::paintBackground ( QPainter &  painter,
const QRect &  rectangle 
) [virtual, inherited]

Definition at line 196 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::paintBackgroundAttributes().

Referenced by paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().

00197 {
00198     Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
00199                 "Private class was not initialized!" );
00200     paintBackgroundAttributes( painter, rect, d->backgroundAttributes );
00201 }

void AbstractAreaBase::paintBackgroundAttributes ( QPainter &  painter,
const QRect &  rectangle,
const KDChart::BackgroundAttributes attributes 
) [static, inherited]

Definition at line 127 of file KDChartAbstractAreaBase.cpp.

References KDChart::BackgroundAttributes::BackgroundPixmapModeCentered, KDChart::BackgroundAttributes::BackgroundPixmapModeNone, KDChart::BackgroundAttributes::BackgroundPixmapModeScaled, KDChart::BackgroundAttributes::BackgroundPixmapModeStretched, KDChart::BackgroundAttributes::brush(), KDChart::BackgroundAttributes::isVisible(), KDChart::BackgroundAttributes::pixmap(), and KDChart::BackgroundAttributes::pixmapMode().

Referenced by KDChart::AbstractAreaBase::paintBackground().

00129 {
00130     if( !attributes.isVisible() ) return;
00131 
00132     /* first draw the brush (may contain a pixmap)*/
00133     if( Qt::NoBrush != attributes.brush().style() ) {
00134         KDChart::PainterSaver painterSaver( &painter );
00135         painter.setPen( Qt::NoPen );
00136         const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) );
00137         painter.setBrushOrigin( newTopLeft );
00138         painter.setBrush( attributes.brush() );
00139         painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) );
00140     }
00141     /* next draw the backPixmap over the brush */
00142     if( !attributes.pixmap().isNull() &&
00143         attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) {
00144         QPointF ol = rect.topLeft();
00145         if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() )
00146         {
00147             ol.setX( rect.center().x() - attributes.pixmap().width() / 2 );
00148             ol.setY( rect.center().y() - attributes.pixmap().height()/ 2 );
00149             painter.drawPixmap( ol, attributes.pixmap() );
00150         } else {
00151             QMatrix m;
00152             double zW = (double)rect.width()  / (double)attributes.pixmap().width();
00153             double zH = (double)rect.height() / (double)attributes.pixmap().height();
00154             switch( attributes.pixmapMode() ) {
00155             case BackgroundAttributes::BackgroundPixmapModeScaled:
00156             {
00157                 double z;
00158                 z = qMin( zW, zH );
00159                 m.scale( z, z );
00160             }
00161             break;
00162             case BackgroundAttributes::BackgroundPixmapModeStretched:
00163                 m.scale( zW, zH );
00164                 break;
00165             default:
00166                 ; // Cannot happen, previously checked
00167             }
00168             QPixmap pm = attributes.pixmap().transformed( m );
00169             ol.setX( rect.center().x() - pm.width() / 2 );
00170             ol.setY( rect.center().y() - pm.height()/ 2 );
00171             painter.drawPixmap( ol, pm );
00172         }
00173     }
00174 }

void KDChart::AbstractLayoutItem::paintCtx ( PaintContext context  )  [virtual, inherited]

Default impl: Paint the complete item using its layouted position and size.

Reimplemented in KDChart::CartesianAxis, and KDChart::TernaryAxis.

Definition at line 77 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().

00078 {
00079     if( context )
00080         paint( context->painter() );
00081 }

void AbstractAreaBase::paintFrame ( QPainter &  painter,
const QRect &  rectangle 
) [virtual, inherited]

Definition at line 204 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::paintFrameAttributes().

Referenced by paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().

00205 {
00206     Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
00207                 "Private class was not initialized!" );
00208     paintFrameAttributes( painter, rect, d->frameAttributes );
00209 }

void AbstractAreaBase::paintFrameAttributes ( QPainter &  painter,
const QRect &  rectangle,
const KDChart::FrameAttributes attributes 
) [static, inherited]

Definition at line 177 of file KDChartAbstractAreaBase.cpp.

References KDChart::FrameAttributes::isVisible(), and KDChart::FrameAttributes::pen().

Referenced by KDChart::AbstractAreaBase::paintFrame().

00179 {
00180 
00181     if( !attributes.isVisible() ) return;
00182 
00183     // Note: We set the brush to NoBrush explicitely here.
00184     //       Otherwise we might get a filled rectangle, so any
00185     //       previously drawn background would be overwritten by that area.
00186 
00187     const QPen   oldPen(   painter.pen() );
00188     const QBrush oldBrush( painter.brush() );
00189     painter.setPen(   attributes.pen() );
00190     painter.setBrush( Qt::NoBrush );
00191     painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) );
00192     painter.setBrush( oldBrush );
00193     painter.setPen(   oldPen );
00194 }

void TextArea::paintIntoRect ( QPainter &  painter,
const QRect &  rect 
) [virtual]

Draws the background and frame, then calls paint().

In most cases there is no need to overwrite this method in a derived class, but you would overwrite TextLayoutItem::paint() instead.

Definition at line 71 of file KDChartTextArea.cpp.

References KDChart::TextLayoutItem::geometry(), paintAll(), and KDChart::TextLayoutItem::setGeometry().

00072 {
00073     const QRect oldGeometry( geometry() );
00074     if( oldGeometry != rect )
00075         setGeometry( rect );
00076     painter.translate( rect.left(), rect.top() );
00077     paintAll( painter );
00078     painter.translate( -rect.left(), -rect.top() );
00079     if( oldGeometry != rect )
00080         setGeometry( oldGeometry );
00081 }

QLayout* KDChart::AbstractLayoutItem::parentLayout (  )  [inherited]

Definition at line 76 of file KDChartLayoutItems.h.

00077         {
00078             return mParentLayout;
00079         }

void KDChart::TextArea::positionChanged ( TextArea  )  [signal]

Referenced by positionHasChanged().

void TextArea::positionHasChanged (  )  [protected, virtual]

Reimplemented from KDChart::AbstractAreaBase.

Definition at line 110 of file KDChartTextArea.cpp.

References positionChanged().

00111 {
00112     emit positionChanged( this );
00113 }

QFont KDChart::TextLayoutItem::realFont (  )  const [virtual, inherited]

Definition at line 230 of file KDChartLayoutItems.cpp.

Referenced by KDChart::CartesianAxis::maximumSize(), and KDChart::CartesianAxis::paintCtx().

00231 {
00232     realFontWasRecalculated(); // we can safely ignore the boolean return value
00233     return cachedFont;
00234 }

qreal KDChart::TextLayoutItem::realFontSize (  )  const [virtual, inherited]

Definition at line 210 of file KDChartLayoutItems.cpp.

References KDChart::TextAttributes::calculatedFontSize().

00211 {
00212     return mAttributes.calculatedFontSize( mAutoReferenceArea, mAutoReferenceOrientation );
00213 }

void KDChart::AbstractLayoutItem::removeFromParentLayout (  )  [inherited]

Definition at line 80 of file KDChartLayoutItems.h.

Referenced by KDChart::Chart::takeCoordinatePlane().

00081         {
00082             if( mParentLayout ){
00083                 if( widget() )
00084                     mParentLayout->removeWidget( widget() );
00085                 else
00086                     mParentLayout->removeItem( this );
00087             }
00088         }

void KDChart::TextLayoutItem::setAutoReferenceArea ( const QObject area  )  [inherited]

Definition at line 128 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::sizeHint().

Referenced by KDChart::HeaderFooter::setParent().

00129 {
00130     mAutoReferenceArea = area;
00131     cachedSizeHint = QSize();
00132     sizeHint();
00133 }

void AbstractAreaBase::setBackgroundAttributes ( const BackgroundAttributes a  )  [inherited]

Definition at line 111 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::positionHasChanged().

00112 {
00113     if( d->backgroundAttributes == a )
00114         return;
00115 
00116     d->backgroundAttributes = a;
00117     positionHasChanged();
00118 }

void AbstractAreaBase::setFrameAttributes ( const FrameAttributes a  )  [inherited]

Definition at line 97 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::positionHasChanged().

Referenced by KDChart::Legend::clone().

00098 {
00099     if( d->frameAttributes == a )
00100         return;
00101 
00102     d->frameAttributes = a;
00103     positionHasChanged();
00104 }

void KDChart::TextLayoutItem::setGeometry ( const QRect &  r  )  [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 204 of file KDChartLayoutItems.cpp.

Referenced by paintAll(), KDChart::CartesianAxis::paintCtx(), and paintIntoRect().

00205 {
00206     mRect = r;
00207 }

void KDChart::AbstractLayoutItem::setParentLayout ( QLayout *  lay  )  [inherited]

Definition at line 72 of file KDChartLayoutItems.h.

00073         {
00074             mParentLayout = lay;
00075         }

void KDChart::AbstractLayoutItem::setParentWidget ( QWidget widget  )  [virtual, inherited]

Inform the item about its widget: This enables the item, to trigger that widget's update, whenever the size of the item's contents has changed.

Thus, you need to call setParentWidget on every item, that has a non-fixed size.

Definition at line 64 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

Referenced by KDChart::HeaderFooter::setParent(), and KDChart::AbstractCartesianDiagram::takeAxis().

00065 {
00066     mParent = widget;
00067 }

void KDChart::TextLayoutItem::setText ( const QString &  text  )  [inherited]

Definition at line 140 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent, and KDChart::TextLayoutItem::sizeHint().

Referenced by KDChart::Widget::addHeaderFooter(), KDChart::CartesianAxis::maximumSize(), and KDChart::CartesianAxis::paintCtx().

00141 {
00142     mText = text;
00143     cachedSizeHint = QSize();
00144     sizeHint();
00145     if( mParent )
00146         mParent->update();
00147 }

void KDChart::TextLayoutItem::setTextAttributes ( const TextAttributes a  )  [inherited]

Use this to specify the text attributes to be used for this item.

See also:
textAttributes

Definition at line 159 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent, and KDChart::TextLayoutItem::sizeHint().

Referenced by KDChart::HeaderFooter::clone().

00160 {
00161     mAttributes = a;
00162     cachedSizeHint = QSize(); // invalidate size hint
00163     sizeHint();
00164     if( mParent )
00165         mParent->update();
00166 }

QSize KDChart::TextLayoutItem::sizeHint (  )  const [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 299 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::sizeHintChanged().

Referenced by KDChart::TextLayoutItem::maximumSize(), KDChart::CartesianAxis::maximumSize(), KDChart::TextLayoutItem::minimumSize(), KDChart::CartesianAxis::paintCtx(), KDChart::TextLayoutItem::setAutoReferenceArea(), KDChart::TextLayoutItem::setText(), and KDChart::TextLayoutItem::setTextAttributes().

00300 {
00301     if( realFontWasRecalculated() )
00302     {
00303         const QSize newSizeHint( calcSizeHint( cachedFont ) );
00304         if( newSizeHint != cachedSizeHint ){
00305             cachedSizeHint = newSizeHint;
00306             sizeHintChanged();
00307         }
00308     }
00309     //qDebug() << "-------- KDChart::TextLayoutItem::sizeHint() returns:"<<cachedSizeHint<<" ----------";
00310     return cachedSizeHint;
00311 }

void KDChart::AbstractLayoutItem::sizeHintChanged (  )  const [virtual, inherited]

Report changed size hint: ask the parent widget to recalculate the layout.

Definition at line 86 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

Referenced by KDChart::TextLayoutItem::sizeHint().

00087 {
00088     // This is exactly like what QWidget::updateGeometry does.
00089 //  qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
00090     if( mParent ) {
00091         if ( mParent->layout() )
00092             mParent->layout()->invalidate();
00093         else
00094             QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
00095     }
00096 }

QString KDChart::TextLayoutItem::text (  )  const [inherited]

Definition at line 149 of file KDChartLayoutItems.cpp.

Referenced by KDChart::HeaderFooter::compare(), and KDChart::CartesianAxis::paintCtx().

00150 {
00151     return mText;
00152 }

KDChart::TextAttributes KDChart::TextLayoutItem::textAttributes (  )  const [inherited]

Returns the text attributes to be used for this item.

See also:
setTextAttributes

Definition at line 173 of file KDChartLayoutItems.cpp.

Referenced by KDChart::HeaderFooter::clone(), and KDChart::HeaderFooter::compare().

00174 {
00175     return mAttributes;
00176 }


Member Data Documentation

QWidget* KDChart::AbstractLayoutItem::mParent [protected, inherited]

Definition at line 90 of file KDChartLayoutItems.h.

Referenced by KDChart::AbstractLayoutItem::setParentWidget(), KDChart::TextLayoutItem::setText(), KDChart::TextLayoutItem::setTextAttributes(), and KDChart::AbstractLayoutItem::sizeHintChanged().

QLayout* KDChart::AbstractLayoutItem::mParentLayout [protected, inherited]

Definition at line 91 of file KDChartLayoutItems.h.

Referenced by KDChart::AutoSpacerLayoutItem::paint().


The documentation for this class was generated from the following files:
Generated on Mon Sep 17 16:18:31 2007 for KD Chart 2 by  doxygen 1.5.1