All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
te::layout::TextItem Class Reference

Class that represents text. This object is of type QGraphicsTextItem. He is directly editable via user interaction. His transformation matrix is inverted, that is, the inverse of the matrix of the scene, so its coordinate system is screen (pixel), but its position in the scene remains in millimeters. Drawing starting point is llx, lly. He is also the son of ItemObserver, so it can become observer of a model (Observable). "View" part of MVC component. More...

#include <TextItem.h>

Inheritance diagram for te::layout::TextItem:
te::layout::ParentItem< QGraphicsTextItem > te::layout::ItemObserver te::layout::Observer te::layout::BarCodeItem te::layout::TitleItem te::layout::TextGridItem

Public Member Functions

virtual QRectF boundingRect () const
 Reimplemented from QGraphicsItem. More...
 
virtual void changeZoomFactor (double currentZoomFactor)
 It is called immediately by the Scene when the zoom factor is changed in the Context. More...
 
virtual bool contains (const QPointF &point) const
 
virtual ItemControllergetController ()
 Returns the "Controller" part of the MVC. More...
 
virtual QImage getImage ()
 Reimplemented from ItemObserver. More...
 
virtual ObservablegetModel ()
 Returns the "Model" part of the MVC. More...
 
virtual std::string getNameClass ()
 Method that returns the class name. More...
 
virtual QPixmap getPixmap ()
 
virtual te::color::RGBAColor ** getRGBAColorImage (int &w, int &h)
 Reimplemented from ItemObserver. More...
 
virtual bool isCanChangeGraphicOrder ()
 Returns whether the graphic component to be or not send to back or bring to front. More...
 
virtual bool isEditable ()
 
virtual bool isInvertedMatrix ()
 Returns whether the graph component has the inverted matrix, otherwise the matrix scene. More...
 
virtual bool isPrintable ()
 Returns whether the graphic component is printable. More...
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
 Reimplemented from QGraphicsTextItem. More...
 
virtual void recalculateBoundingRect ()
 The default implementation does nothing. More...
 
virtual void redraw (bool bRefresh=true)
 Redraws the graphic component. More...
 
virtual void refresh (bool pos=true)
 Updated model state. More...
 
virtual void refreshDocument ()
 
virtual void setCanChangeGraphicOrder (bool canChange)
 Change the state of the graphic component to be or not send to back or bring to front. More...
 
virtual void setEditable (bool editable)
 
virtual void setPixmap (const QPixmap &pixmap)
 
virtual void setPrintable (bool print)
 Modifies the state of the graphic component to be or not printable. More...
 
virtual void setRect (QRectF rect)
 
void setZValue (qreal z)
 The Z value decides the stacking order of drawing. More...
 
 TextItem (ItemController *controller, Observable *o)
 Constructor. More...
 
virtual void updateObserver (ContextItem context)
 Reimplemented from ItemObserver. More...
 
virtual ~TextItem ()
 Destructor. More...
 

Protected Member Functions

virtual void applyRotation ()
 Reimplemented from ItemObserver. More...
 
virtual QPixmap calculateNewPixmap (const double &x, const double &y)
 
virtual bool checkTouchesCorner (const double &x, const double &y)
 
virtual QImage createImage ()
 
virtual te::gm::Envelope createNewBoxInCoordScene (const double &x, const double &y)
 
virtual void createResizePixmap ()
 
virtual void drawBackground (QPainter *painter)
 
virtual void drawBorder (QPainter *painter)
 
virtual void drawSelection (QPainter *painter)
 
virtual void drawText (QPointF point, QPainter *painter, std::string text)
 Draw a text. Converts boundingRect item coordinates (local coordinates) in pixel coordinates (screen coordinates) of the current device. More...
 
virtual void getDocumentSizeMM (double &w, double &h)
 
virtual te::gm::Coord2D getPosition ()
 Reimplemented from ItemObserver. More...
 
virtual int getZValueItem ()
 Reimplemented from ItemObserver. More...
 
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *event)
 Reimplemented from QGraphicsItem. More...
 
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
 Reimplemented from QGraphicsItem. More...
 
virtual void hoverMoveEvent (QGraphicsSceneHoverEvent *event)
 Reimplemented from QGraphicsItem. More...
 
virtual void init ()
 
virtual QVariant itemChange (GraphicsItemChange change, const QVariant &value)
 Reimplemented from QGraphicsTextItem. More...
 
virtual QVariant itemChange (QGraphicsItem::GraphicsItemChange change, const QVariant &value)
 Reimplemented from QGraphicsItem. More...
 
virtual void keyPressEvent (QKeyEvent *event)
 Reimplemented from QGraphicsTextItem. More...
 
virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
 Reimplemented from QGraphicsTextItem. More...
 
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
 Reimplemented from QGraphicsTextItem. More...
 
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event)
 Reimplemented from QGraphicsTextItem. More...
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 Reimplemented from QGraphicsTextItem. More...
 
virtual void resetEdit ()
 
virtual void setZValueItem (int z)
 The Z value decides the stacking order of drawing. More...
 
virtual void updateTextConfig ()
 

Protected Attributes

QColor m_backgroundColor
 
te::gm::Envelope m_boxCopy
 box with resize More...
 
bool m_canChangeGraphicOrder
 Define if item can send to back or bring to front. More...
 
QPixmap m_clonePixmap
 
te::layout::ItemControllerm_controller
 "Controller" part of MVC component. More...
 
bool m_editable
 
LayoutAlign m_enumSides
 
QPointF m_finalCoord
 
QPointF m_initialCoord
 
bool m_invertedMatrix
 true if inverted, false otherwise the matrix scene More...
 
te::layout::Observablem_model
 "Model" part of MVC component. More...
 
bool m_mousePressedAlt
 mouse and active alt key More...
 
bool m_move
 
std::string m_nameClass
 Class name. More...
 
QPixmap m_pixmap
 
bool m_printable
 State of the graphic component to be or not printable. More...
 
QRectF m_rect
 
bool m_resizeMode
 pixmap to perform the resize is already built More...
 
QTextTable * m_table
 
bool m_toResizeItem
 pixmap to perform the resize is not yet built More...
 

Detailed Description

Class that represents text. This object is of type QGraphicsTextItem. He is directly editable via user interaction. His transformation matrix is inverted, that is, the inverse of the matrix of the scene, so its coordinate system is screen (pixel), but its position in the scene remains in millimeters. Drawing starting point is llx, lly. He is also the son of ItemObserver, so it can become observer of a model (Observable). "View" part of MVC component.

See also
te::layout::ItemObserver

Definition at line 70 of file TextItem.h.

Constructor & Destructor Documentation

te::layout::TextItem::TextItem ( ItemController controller,
Observable o 
)

Constructor.

Parameters
controller"Controller" part of MVC component
o"Model" part of MVC component

Definition at line 58 of file TextItem.cpp.

References init(), m_backgroundColor, and te::layout::ItemObserver::m_nameClass.

te::layout::TextItem::~TextItem ( )
virtual

Destructor.

Definition at line 73 of file TextItem.cpp.

Member Function Documentation

virtual void te::layout::ParentItem< QGraphicsTextItem >::applyRotation ( )
protectedvirtualinherited

Reimplemented from ItemObserver.

Implements te::layout::ItemObserver.

QRectF te::layout::TextItem::boundingRect ( ) const
virtual

Reimplemented from QGraphicsItem.

Reimplemented from te::layout::ParentItem< QGraphicsTextItem >.

Definition at line 419 of file TextItem.cpp.

virtual QPixmap te::layout::ParentItem< QGraphicsTextItem >::calculateNewPixmap ( const double &  x,
const double &  y 
)
protectedvirtualinherited
void te::layout::ItemObserver::changeZoomFactor ( double  currentZoomFactor)
virtualinherited

It is called immediately by the Scene when the zoom factor is changed in the Context.

Parameters
currentZoomFactorcurrent zoom factor of the layout module

Reimplemented in te::layout::MapItem.

Definition at line 134 of file ItemObserver.cpp.

Referenced by te::layout::Scene::onChangeZoomFactor().

virtual bool te::layout::ParentItem< QGraphicsTextItem >::checkTouchesCorner ( const double &  x,
const double &  y 
)
protectedvirtualinherited
virtual bool te::layout::ParentItem< QGraphicsTextItem >::contains ( const QPointF &  point) const
virtualinherited
QImage te::layout::TextItem::createImage ( )
protectedvirtual
virtual te::gm::Envelope te::layout::ParentItem< QGraphicsTextItem >::createNewBoxInCoordScene ( const double &  x,
const double &  y 
)
protectedvirtualinherited
virtual void te::layout::ParentItem< QGraphicsTextItem >::createResizePixmap ( )
protectedvirtualinherited
virtual void te::layout::ParentItem< QGraphicsTextItem >::drawBackground ( QPainter *  painter)
protectedvirtualinherited
virtual void te::layout::ParentItem< QGraphicsTextItem >::drawBorder ( QPainter *  painter)
protectedvirtualinherited
virtual void te::layout::ParentItem< QGraphicsTextItem >::drawSelection ( QPainter *  painter)
protectedvirtualinherited
virtual void te::layout::ParentItem< QGraphicsTextItem >::drawText ( QPointF  point,
QPainter *  painter,
std::string  text 
)
protectedvirtualinherited

Draw a text. Converts boundingRect item coordinates (local coordinates) in pixel coordinates (screen coordinates) of the current device.

Parameters
pointinitial text coordinate (local coordinates from boundingRect)
painterlow-level painting on widgets and other paint devices
text
te::layout::ItemController * te::layout::ItemObserver::getController ( )
virtualinherited

Returns the "Controller" part of the MVC.

Returns
controller

Definition at line 99 of file ItemObserver.cpp.

void te::layout::TextItem::getDocumentSizeMM ( double &  w,
double &  h 
)
protectedvirtual

Definition at line 338 of file TextItem.cpp.

virtual QImage te::layout::ParentItem< QGraphicsTextItem >::getImage ( )
virtualinherited

Reimplemented from ItemObserver.

te::layout::Observable * te::layout::ItemObserver::getModel ( )
virtualinherited

Returns the "Model" part of the MVC.

Returns
model

Definition at line 104 of file ItemObserver.cpp.

Referenced by te::layout::BuildGraphicsItem::addChild(), te::layout::ItemModelObservable::addChildren(), te::layout::VisitorUtils::changeMapVisitable(), te::layout::PropertiesOutside::changeMapVisitable(), te::layout::MenuBuilder::changePropertyValue(), te::layout::ChangePropertyCommand::checkItem(), te::layout::ItemUtils::countType(), te::layout::AddCommand::createCommandString(), te::layout::MoveCommand::createCommandString(), te::layout::ChangePropertyCommand::createCommandString(), te::layout::ItemUtils::createLegendChildAsObject(), te::layout::ObjectInspectorOutside::createProperty(), te::layout::ItemUtils::createTextItemFromObject(), te::layout::ItemUtils::createTextMapAsObject(), te::layout::Scene::deleteItems(), te::layout::PropertiesUtils::equalsHashCode(), te::layout::Scene::exportItemsToImage(), te::layout::PropertiesUtils::getAllProperties(), te::layout::Scene::getItemsProperties(), te::layout::ItemUtils::getMapItem(), te::layout::PropertiesOutside::getMapModel(), te::layout::ObjectInspectorOutside::hasMoveItemGroup(), te::layout::PropertiesUtils::intersection(), te::layout::GridMapItem::itemChange(), te::layout::ParentItem< T >::itemChange(), te::layout::ObjectInspectorOutside::itemsInspector(), te::layout::ItemUtils::mapNameList(), te::layout::ItemUtils::maxTypeId(), te::layout::View::mousePressEvent(), te::layout::Scene::removeSelectedItems(), te::layout::PropertiesUtils::sameProperties(), te::layout::Scene::selectItem(), te::layout::ObjectInspectorOutside::selectItems(), te::layout::PropertiesOutside::sendPropertyToSelectedItem(), and te::layout::PropertiesOutside::sendPropertyToSelectedItems().

std::string te::layout::ItemObserver::getNameClass ( )
virtualinherited

Method that returns the class name.

Returns
class name

Definition at line 124 of file ItemObserver.cpp.

Referenced by te::layout::ObjectInspectorOutside::createProperty().

virtual QPixmap te::layout::ParentItem< QGraphicsTextItem >::getPixmap ( )
virtualinherited
te::gm::Coord2D te::layout::TextItem::getPosition ( )
protectedvirtual

Reimplemented from ItemObserver.

Reimplemented from te::layout::ParentItem< QGraphicsTextItem >.

Definition at line 213 of file TextItem.cpp.

References te::gm::Coord2D::x, and te::gm::Coord2D::y.

te::color::RGBAColor ** te::layout::TextItem::getRGBAColorImage ( int &  w,
int &  h 
)
virtual

Reimplemented from ItemObserver.

Reimplemented from te::layout::ParentItem< QGraphicsTextItem >.

Definition at line 231 of file TextItem.cpp.

References te::qt::widgets::GetImage().

virtual int te::layout::ParentItem< QGraphicsTextItem >::getZValueItem ( )
protectedvirtualinherited

Reimplemented from ItemObserver.

Implements te::layout::ItemObserver.

virtual void te::layout::ParentItem< QGraphicsTextItem >::hoverEnterEvent ( QGraphicsSceneHoverEvent *  event)
protectedvirtualinherited

Reimplemented from QGraphicsItem.

virtual void te::layout::ParentItem< QGraphicsTextItem >::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  event)
protectedvirtualinherited

Reimplemented from QGraphicsItem.

virtual void te::layout::ParentItem< QGraphicsTextItem >::hoverMoveEvent ( QGraphicsSceneHoverEvent *  event)
protectedvirtualinherited

Reimplemented from QGraphicsItem.

void te::layout::TextItem::init ( )
protectedvirtual
bool te::layout::ItemObserver::isCanChangeGraphicOrder ( )
virtualinherited

Returns whether the graphic component to be or not send to back or bring to front.

Returns
true if send to back or bring to front, false otherwise

Definition at line 119 of file ItemObserver.cpp.

Referenced by te::layout::AlignItems::bringToFront(), te::layout::Scene::createItem(), and te::layout::AlignItems::sendToBack().

bool te::layout::TextItem::isEditable ( )
virtual
Returns

Definition at line 333 of file TextItem.cpp.

bool te::layout::ItemObserver::isInvertedMatrix ( )
virtualinherited

Returns whether the graph component has the inverted matrix, otherwise the matrix scene.

Returns
true if inverted, false otherwise

Definition at line 129 of file ItemObserver.cpp.

Referenced by te::layout::Scene::insertItem(), and te::layout::View::mousePressEvent().

bool te::layout::ItemObserver::isPrintable ( )
virtualinherited

Returns whether the graphic component is printable.

Returns
true if printable, false otherwise

Definition at line 94 of file ItemObserver.cpp.

Referenced by te::layout::Scene::getItemsProperties(), and te::layout::Scene::redrawItems().

QVariant te::layout::TextItem::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)
protectedvirtual

Reimplemented from QGraphicsTextItem.

Definition at line 244 of file TextItem.cpp.

virtual QVariant te::layout::ParentItem< QGraphicsTextItem >::itemChange ( QGraphicsItem::GraphicsItemChange  change,
const QVariant &  value 
)
protectedvirtualinherited

Reimplemented from QGraphicsItem.

void te::layout::TextItem::keyPressEvent ( QKeyEvent *  event)
protectedvirtual

Reimplemented from QGraphicsTextItem.

Definition at line 274 of file TextItem.cpp.

void te::layout::TextItem::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

Reimplemented from QGraphicsTextItem.

Definition at line 280 of file TextItem.cpp.

void te::layout::TextItem::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

Reimplemented from QGraphicsTextItem.

Reimplemented from te::layout::ParentItem< QGraphicsTextItem >.

Definition at line 302 of file TextItem.cpp.

void te::layout::TextItem::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

Reimplemented from QGraphicsTextItem.

Reimplemented from te::layout::ParentItem< QGraphicsTextItem >.

Definition at line 313 of file TextItem.cpp.

void te::layout::TextItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

Reimplemented from QGraphicsTextItem.

Reimplemented from te::layout::ParentItem< QGraphicsTextItem >.

Definition at line 323 of file TextItem.cpp.

void te::layout::TextItem::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = 0 
)
virtual

Reimplemented from QGraphicsTextItem.

Reimplemented from te::layout::ParentItem< QGraphicsTextItem >.

Reimplemented in te::layout::BarCodeItem.

Definition at line 127 of file TextItem.cpp.

void te::layout::ItemObserver::recalculateBoundingRect ( )
virtualinherited

The default implementation does nothing.

Reimplemented in te::layout::MapItem, and te::layout::GridMapItem.

Definition at line 139 of file ItemObserver.cpp.

void te::layout::ItemObserver::refresh ( bool  pos = true)
virtualinherited

Updated model state.

Parameters
trueif refresh the current position, false otherwise

Definition at line 78 of file ItemObserver.cpp.

References te::gm::Coord2D::x, and te::gm::Coord2D::y.

Referenced by te::layout::ItemController::contains(), te::layout::Scene::insertItem(), and te::layout::Scene::updateSelectedItemsPositions().

void te::layout::TextItem::refreshDocument ( )
virtual
void te::layout::TextItem::resetEdit ( )
protectedvirtual
void te::layout::ItemObserver::setCanChangeGraphicOrder ( bool  canChange)
virtualinherited

Change the state of the graphic component to be or not send to back or bring to front.

Parameters
canChangetrue if send to back or bring to front, false otherwise

Definition at line 114 of file ItemObserver.cpp.

void te::layout::TextItem::setEditable ( bool  editable)
virtual
Parameters

Definition at line 345 of file TextItem.cpp.

virtual void te::layout::ParentItem< QGraphicsTextItem >::setPixmap ( const QPixmap &  pixmap)
virtualinherited
void te::layout::ItemObserver::setPrintable ( bool  print)
virtualinherited

Modifies the state of the graphic component to be or not printable.

Parameters
printtrue if printable, false otherwise

Definition at line 89 of file ItemObserver.cpp.

virtual void te::layout::ParentItem< QGraphicsTextItem >::setRect ( QRectF  rect)
virtualinherited
void te::layout::ParentItem< QGraphicsTextItem >::setZValue ( qreal  z)
inherited

The Z value decides the stacking order of drawing.

Parameters
drawingorder
void te::layout::ItemObserver::setZValueItem ( int  z)
protectedvirtualinherited

The Z value decides the stacking order of drawing.

Parameters
drawingorder

Definition at line 109 of file ItemObserver.cpp.

void te::layout::TextItem::updateObserver ( ContextItem  context)
virtual

Reimplemented from ItemObserver.

Reimplemented from te::layout::ParentItem< QGraphicsTextItem >.

Reimplemented in te::layout::TitleItem.

Definition at line 106 of file TextItem.cpp.

References te::layout::TextModel::getText().

Member Data Documentation

QColor te::layout::TextItem::m_backgroundColor
protected

Definition at line 172 of file TextItem.h.

Referenced by TextItem().

te::gm::Envelope te::layout::ParentItem< QGraphicsTextItem >::m_boxCopy
protectedinherited

box with resize

Definition at line 223 of file ParentItem.h.

bool te::layout::ItemObserver::m_canChangeGraphicOrder
protectedinherited

Define if item can send to back or bring to front.

Definition at line 200 of file ItemObserver.h.

Referenced by te::layout::PaperItem::PaperItem().

QPixmap te::layout::ParentItem< QGraphicsTextItem >::m_clonePixmap
protectedinherited

Definition at line 224 of file ParentItem.h.

te::layout::ItemController* te::layout::ItemObserver::m_controller
protectedinherited

"Controller" part of MVC component.

Definition at line 197 of file ItemObserver.h.

bool te::layout::TextItem::m_editable
protected

Definition at line 173 of file TextItem.h.

LayoutAlign te::layout::ParentItem< QGraphicsTextItem >::m_enumSides
protectedinherited

Definition at line 229 of file ParentItem.h.

QPointF te::layout::ParentItem< QGraphicsTextItem >::m_finalCoord
protectedinherited

Definition at line 227 of file ParentItem.h.

QPointF te::layout::ParentItem< QGraphicsTextItem >::m_initialCoord
protectedinherited

Definition at line 226 of file ParentItem.h.

bool te::layout::ItemObserver::m_invertedMatrix
protectedinherited

true if inverted, false otherwise the matrix scene

Definition at line 202 of file ItemObserver.h.

Referenced by te::layout::BarCodeItem::BarCodeItem(), and te::layout::ParentItem< T >::ParentItem().

te::layout::Observable* te::layout::ItemObserver::m_model
protectedinherited
bool te::layout::ParentItem< QGraphicsTextItem >::m_mousePressedAlt
protectedinherited

mouse and active alt key

Definition at line 225 of file ParentItem.h.

bool te::layout::TextItem::m_move
protected

Definition at line 175 of file TextItem.h.

QPixmap te::layout::ParentItem< QGraphicsTextItem >::m_pixmap
protectedinherited

Definition at line 219 of file ParentItem.h.

bool te::layout::ItemObserver::m_printable
protectedinherited

State of the graphic component to be or not printable.

Definition at line 199 of file ItemObserver.h.

QRectF te::layout::ParentItem< QGraphicsTextItem >::m_rect
protectedinherited

Definition at line 220 of file ParentItem.h.

bool te::layout::ParentItem< QGraphicsTextItem >::m_resizeMode
protectedinherited

pixmap to perform the resize is already built

Definition at line 230 of file ParentItem.h.

QTextTable* te::layout::TextItem::m_table
protected

Definition at line 174 of file TextItem.h.

bool te::layout::ParentItem< QGraphicsTextItem >::m_toResizeItem
protectedinherited

pixmap to perform the resize is not yet built

Definition at line 228 of file ParentItem.h.


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