KDChart::TextBubbleLayoutItem Class Reference

#include <KDChartLayoutItems.h>

Inheritance diagram for KDChart::TextBubbleLayoutItem:

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

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 174 of file KDChartLayoutItems.h.


Public Member Functions

const QObjectautoReferenceArea () const
virtual Qt::Orientations expandingDirections () const
 pure virtual in QLayoutItem
virtual QRect geometry () const
 pure virtual in QLayoutItem
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 *painter)
virtual void paintAll (QPainter &painter)
 Default impl: just call paint.
virtual void paintCtx (PaintContext *context)
 Default impl: Paint the complete item using its layouted position and size.
QLayout * parentLayout ()
void removeFromParentLayout ()
void setAutoReferenceArea (const QObject *area)
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)
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
 TextBubbleLayoutItem (const QString &text, const TextAttributes &attributes, const QObject *autoReferenceArea, KDChartEnums::MeasureOrientation autoReferenceOrientation, Qt::Alignment alignment=0)
 TextBubbleLayoutItem ()
 ~TextBubbleLayoutItem ()

Protected Member Functions

int borderWidth () const

Protected Attributes

QWidgetmParent
QLayout * mParentLayout

Constructor & Destructor Documentation

KDChart::TextBubbleLayoutItem::TextBubbleLayoutItem (  ) 

Definition at line 109 of file KDChartLayoutItems.cpp.

00110     : AbstractLayoutItem( Qt::AlignLeft ),
00111       m_text( new TextLayoutItem() )
00112 {
00113 }

KDChart::TextBubbleLayoutItem::TextBubbleLayoutItem ( const QString &  text,
const TextAttributes attributes,
const QObject autoReferenceArea,
KDChartEnums::MeasureOrientation  autoReferenceOrientation,
Qt::Alignment  alignment = 0 
)

Definition at line 99 of file KDChartLayoutItems.cpp.

00104     : AbstractLayoutItem( alignment ),
00105       m_text( new TextLayoutItem( text, attributes, area, orientation, alignment ) )
00106 {
00107 }

KDChart::TextBubbleLayoutItem::~TextBubbleLayoutItem (  ) 

Definition at line 115 of file KDChartLayoutItems.cpp.

00116 {
00117     delete m_text;
00118 }


Member Function Documentation

const QObject * KDChart::TextBubbleLayoutItem::autoReferenceArea (  )  const

Definition at line 125 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::autoReferenceArea().

00126 {
00127     return m_text->autoReferenceArea();
00128 }

int KDChart::TextBubbleLayoutItem::borderWidth (  )  const [protected]

Definition at line 202 of file KDChartLayoutItems.cpp.

Referenced by geometry(), maximumSize(), minimumSize(), setGeometry(), and sizeHint().

00203 {
00204     return 1;
00205 }

Qt::Orientations KDChart::TextBubbleLayoutItem::expandingDirections (  )  const [virtual]

pure virtual in QLayoutItem

Definition at line 155 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::expandingDirections().

00156 {
00157     return m_text->expandingDirections();
00158 }

QRect KDChart::TextBubbleLayoutItem::geometry (  )  const [virtual]

pure virtual in QLayoutItem

Definition at line 184 of file KDChartLayoutItems.cpp.

References borderWidth(), and KDChart::TextLayoutItem::geometry().

Referenced by paint().

00185 {
00186     const int border = borderWidth();
00187     return m_text->geometry().adjusted( -border, -border, border, border );
00188 }

bool KDChart::TextBubbleLayoutItem::isEmpty (  )  const [virtual]

pure virtual in QLayoutItem

Definition at line 150 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::isEmpty().

00151 {
00152     return m_text->isEmpty();
00153 }

QSize KDChart::TextBubbleLayoutItem::maximumSize (  )  const [virtual]

pure virtual in QLayoutItem

Definition at line 160 of file KDChartLayoutItems.cpp.

References borderWidth(), and KDChart::TextLayoutItem::maximumSize().

00161 {
00162     const int border = borderWidth();
00163     return m_text->maximumSize() + QSize( 2 * border, 2 * border );
00164 }

QSize KDChart::TextBubbleLayoutItem::minimumSize (  )  const [virtual]

pure virtual in QLayoutItem

Definition at line 166 of file KDChartLayoutItems.cpp.

References borderWidth(), and KDChart::TextLayoutItem::minimumSize().

00167 {
00168     const int border = borderWidth();
00169     return m_text->minimumSize() + QSize( 2 * border, 2 * border );
00170 }

void KDChart::TextBubbleLayoutItem::paint ( QPainter *  painter  )  [virtual]

Implements KDChart::AbstractLayoutItem.

Definition at line 190 of file KDChartLayoutItems.cpp.

References geometry(), and KDChart::TextLayoutItem::paint().

00191 {
00192     const QPen oldPen = painter->pen();
00193     const QBrush oldBrush = painter->brush();
00194     painter->setPen( Qt::black );
00195     painter->setBrush( QColor( 255, 255, 220 ) );
00196     painter->drawRoundRect( geometry(), 10 );
00197     painter->setPen( oldPen );
00198     painter->setBrush( oldBrush );
00199     m_text->paint( painter );
00200 }

void KDChart::AbstractLayoutItem::paintAll ( QPainter &  painter  )  [virtual, inherited]

Default impl: just call paint.

Derived classes like KDChart::AbstractArea are providing additional action here.

Reimplemented in KDChart::AbstractArea, KDChart::TextArea, and KDChart::TernaryAxis.

Definition at line 70 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::paint().

00071 {
00072     paint( &painter );
00073 }

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

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

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

Definition at line 78 of file KDChartLayoutItems.cpp.

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

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

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

Definition at line 79 of file KDChartLayoutItems.h.

00080         {
00081             return mParentLayout;
00082         }

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

Definition at line 83 of file KDChartLayoutItems.h.

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

00084         {
00085             if( mParentLayout ){
00086                 if( widget() )
00087                     mParentLayout->removeWidget( widget() );
00088                 else
00089                     mParentLayout->removeItem( this );
00090             }
00091         }

void KDChart::TextBubbleLayoutItem::setAutoReferenceArea ( const QObject area  ) 

Definition at line 120 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::setAutoReferenceArea().

00121 {
00122     m_text->setAutoReferenceArea( area );
00123 }

void KDChart::TextBubbleLayoutItem::setGeometry ( const QRect &  r  )  [virtual]

pure virtual in QLayoutItem

Definition at line 178 of file KDChartLayoutItems.cpp.

References borderWidth(), and KDChart::TextLayoutItem::setGeometry().

00179 {
00180     const int border = borderWidth();
00181     m_text->setGeometry( r.adjusted( border, border, -border, -border ) );
00182 }

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

Definition at line 75 of file KDChartLayoutItems.h.

00076         {
00077             mParentLayout = lay;
00078         }

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 65 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

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

00066 {
00067     mParent = widget;
00068 }

void KDChart::TextBubbleLayoutItem::setText ( const QString &  text  ) 

Definition at line 130 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::setText().

00131 {
00132     m_text->setText( text );
00133 }

void KDChart::TextBubbleLayoutItem::setTextAttributes ( const TextAttributes a  ) 

Definition at line 140 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::setTextAttributes().

00141 {
00142     m_text->setTextAttributes( a );
00143 }

QSize KDChart::TextBubbleLayoutItem::sizeHint (  )  const [virtual]

pure virtual in QLayoutItem

Definition at line 172 of file KDChartLayoutItems.cpp.

References borderWidth(), and KDChart::TextLayoutItem::sizeHint().

00173 {
00174     const int border = borderWidth();
00175     return m_text->sizeHint() + QSize( 2 * border, 2 * border );
00176 }

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

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

Definition at line 87 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

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

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

QString KDChart::TextBubbleLayoutItem::text (  )  const

Definition at line 135 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::text().

00136 {
00137     return m_text->text();
00138 }

KDChart::TextAttributes KDChart::TextBubbleLayoutItem::textAttributes (  )  const

Definition at line 145 of file KDChartLayoutItems.cpp.

References KDChart::TextLayoutItem::textAttributes().

00146 {
00147     return m_text->textAttributes();
00148 }


Member Data Documentation

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

Definition at line 93 of file KDChartLayoutItems.h.

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

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

Definition at line 94 of file KDChartLayoutItems.h.

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


The documentation for this class was generated from the following files:
Generated on Thu Mar 4 23:26:47 2010 for KD Chart 2 by  doxygen 1.5.4