GobChartsWidget  1.0
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
GobChartsTextItem Class Reference

A convenience text item class that can resize itself. More...

#include <gobchartstextitem.h>

Inheritance diagram for GobChartsTextItem:
GobChartsNoCopy

Public Slots

void setRectF (const QRectF &rect)
 Sets the dimensions within which the text item's bounding rectangle must fit.
 

Signals

void identity (const QString &)
 Broadcast the item's identity.
 

Public Member Functions

 GobChartsTextItem (Qt::Orientation orientation, QString uniqueID, QGraphicsItem *parent=0)
 Constructor.
 
void setMaxFontSize (const QFont &font)
 Set maximum font size.
 
void setAlignment (Qt::Alignment alignment)
 Sets the text alignment option (the default is Qt::AlignHCenter).
 
Qt::Alignment alignment () const
 Returns the current text alignment.
 
void receiveKeyEvent (QKeyEvent *event)
 Receives forwarded keyboard input events.
 
QString getStateXML () const
 Returns the label's content and settings as an XML QString.
 
bool setStateXML (const QDomNode &node)
 Set the label's values when loading from file.
 
void setPlainText (const QString &text)
 Re-implemented from QGraphicsTextItem.
 

Protected Member Functions

void mousePressEvent (QGraphicsSceneMouseEvent *event)
 Re-implemented from QGraphicsTextItem.
 
void setFont (const QFont &font)
 Re-implemented from QGraphicsTextItem to call resize() whenever the font is changed.
 

Detailed Description

A convenience text item class that can resize itself.

GobChartsTextItem automatically resizes itself to fit into whichever space is allocated to it and allows for the text alignment to be specified.

Definition at line 38 of file gobchartstextitem.h.

Member Function Documentation

Qt::Alignment GobChartsTextItem::alignment ( ) const

Returns the current text alignment.

See Also
setAlignment()

Definition at line 190 of file gobchartstextitem.cpp.

QString GobChartsTextItem::getStateXML ( ) const

Returns the label's content and settings as an XML QString.

Charts are saved to file as XML, this function takes all the label's settings, converts it to XML and returns the XML string.

See Also
setStateXML()

Definition at line 262 of file gobchartstextitem.cpp.

void GobChartsTextItem::identity ( const QString &  )
signal

Broadcast the item's identity.

void GobChartsTextItem::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
protected

Re-implemented from QGraphicsTextItem.

See Qt API documentation for details.

Definition at line 349 of file gobchartstextitem.cpp.

void GobChartsTextItem::receiveKeyEvent ( QKeyEvent *  event)

Receives forwarded keyboard input events.

Definition at line 255 of file gobchartstextitem.cpp.

void GobChartsTextItem::setAlignment ( Qt::Alignment  alignment)

Sets the text alignment option (the default is Qt::AlignHCenter).

See Also
alignment()

Definition at line 179 of file gobchartstextitem.cpp.

void GobChartsTextItem::setFont ( const QFont &  font)
protected

Re-implemented from QGraphicsTextItem to call resize() whenever the font is changed.

Definition at line 160 of file gobchartstextitem.cpp.

void GobChartsTextItem::setMaxFontSize ( const QFont &  font)

Set maximum font size.

Updates the item's font, but also keeps track of the user selected font size to ensure that, when automatically increasing the text size, the user preference is respected.

Definition at line 152 of file gobchartstextitem.cpp.

void GobChartsTextItem::setPlainText ( const QString &  text)

Re-implemented from QGraphicsTextItem.

See Qt API documentation for details.

Definition at line 168 of file gobchartstextitem.cpp.

void GobChartsTextItem::setRectF ( const QRectF &  rect)
slot

Sets the dimensions within which the text item's bounding rectangle must fit.

The item will reposition itself to be centred within this given rectangular space (it's position will be calculated in terms of this provided rectangle).

Definition at line 119 of file gobchartstextitem.cpp.

bool GobChartsTextItem::setStateXML ( const QDomNode &  node)

Set the label's values when loading from file.

When loading a label from file, the content of the file is parsed from XML and the QDomNodes containing the necessary information for building the label is provided to this function as parameter.

See Also
getStateXML()

Definition at line 308 of file gobchartstextitem.cpp.


The documentation for this class was generated from the following files: