Envision
A visual programming IDE for object-oriented languages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
Visualization::TextRenderer Class Referenceabstract
Inheritance diagram for Visualization::TextRenderer:
Core::Reflect< Base >

Public Types

enum  ApproximateUpdate : int { Unknown = 0 , Approximate = 1 , Exact = 2 }
 
typedef TextStyle StyleType
 

Public Member Functions

 TextRenderer (Item *parent, const StyleType *style, const QString &text={})
 
virtual QList< Visualization::VisualizationAddOn * > addOns () override
 
virtual Visualization::InteractionHandlerhandler () const override
 
virtual bool ignoresCopyAndPaste () override
 
bool isEditable ()
 
bool isHtml () const
 
virtual bool moveCursor (CursorMoveDirection dir=MoveDefault, QRect reference={}, CursorMoveOptions options=None) override
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
 
QString selectedText ()
 
void setEditable (bool editable)
 
virtual void setStyle (const Visualization::ItemStyle *itemStyle) override
 
void setSuppressDefaultCopyPasteHandler (bool suppress)
 
virtual bool setText (const QString &newText)
 Sets the text of this item to newText. More...
 
void setTextFormat (Qt::TextFormat textFormat)
 
const StyleTypestyle () const
 
QString text ()
 Returns the text that is currently cached in this TextRenderer item. More...
 
qreal textXOffset ()
 
qreal textYOffset ()
 

Static Public Member Functions

static void addAddOn (Visualization::VisualizationAddOn *addOn)
 
static Visualization::InteractionHandlerdefaultClassHandler ()
 
static Visualization::StyleSet< TextRenderer > & itemStyles ()
 
static bool removeAddOn (Visualization::VisualizationAddOn *addOn)
 
static void setDefaultClassHandler (Visualization::InteractionHandler *handler)
 

Protected Member Functions

virtual QString currentText ()=0
 Returns the text of that is represented by the current item. More...
 
virtual void determineChildren () override
 
virtual void updateGeometry (int availableWidth, int availableHeight) override
 

Private Member Functions

QRectF nonStaticTextBound ()
 
QSize staticTextSize (QFontMetrics &qfm)
 

Static Private Member Functions

static QList< Visualization::VisualizationAddOn * > & staticAddOns ()
 

Private Attributes

ApproximateUpdate drawApproximately_ {Unknown}
 
bool editable_ {}
 
QStaticText staticText_
 
bool suppressDefaultCopyPasteHandler_ {}
 
qreal textXOffset_
 
qreal textYOffset_
 

Static Private Attributes

static Visualization::InteractionHandlerdefaultClassHandler_ = nullptr
 
static const int MIN_TEXT_WIDTH = 10
 

Additional Inherited Members

- Protected Types inherited from Core::Reflect< Base >
using Super = Reflect< Base >
 

Member Typedef Documentation

◆ StyleType

Member Enumeration Documentation

◆ ApproximateUpdate

Enumerator
Unknown 
Approximate 
Exact 

Constructor & Destructor Documentation

◆ TextRenderer()

Visualization::TextRenderer::TextRenderer ( Item parent,
const StyleType style,
const QString &  text = {} 
)

Member Function Documentation

◆ addAddOn()

void Visualization::TextRenderer::addAddOn ( Visualization::VisualizationAddOn addOn)
static

◆ addOns()

QList< Visualization::VisualizationAddOn * > Visualization::TextRenderer::addOns ( )
overridevirtual

◆ currentText()

virtual QString Visualization::TextRenderer::currentText ( )
protectedpure virtual

Returns the text of that is represented by the current item.

This is an up-to-date value that may differ from the value of text(). E.G. If this is an instance of ItemWithNode<TextRenderer, Text> and the text of the node has just changed, this method will returned the current value of the node, whereas text() will still return the old value.

When the TextRenderer is updated the value returned by currentText() is cached and will be subsequently returned by text() and visualized on the screen.

◆ defaultClassHandler()

static Visualization::InteractionHandler* Visualization::TextRenderer::defaultClassHandler ( )
inlinestatic

◆ determineChildren()

void Visualization::TextRenderer::determineChildren ( )
overrideprotectedvirtual

◆ handler()

Visualization::InteractionHandler * Visualization::TextRenderer::handler ( ) const
overridevirtual

◆ ignoresCopyAndPaste()

bool Visualization::TextRenderer::ignoresCopyAndPaste ( )
overridevirtual

◆ isEditable()

bool Visualization::TextRenderer::isEditable ( )
inline

◆ isHtml()

bool Visualization::TextRenderer::isHtml ( ) const
inline

◆ itemStyles()

Visualization::StyleSet< TextRenderer > & Visualization::TextRenderer::itemStyles ( )
static

◆ moveCursor()

bool Visualization::TextRenderer::moveCursor ( CursorMoveDirection  dir = MoveDefault,
QRect  reference = {},
CursorMoveOptions  options = None 
)
overridevirtual

◆ nonStaticTextBound()

QRectF Visualization::TextRenderer::nonStaticTextBound ( )
inlineprivate

◆ paint()

void Visualization::TextRenderer::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)
overridevirtual

◆ removeAddOn()

bool Visualization::TextRenderer::removeAddOn ( Visualization::VisualizationAddOn addOn)
static

◆ selectedText()

QString Visualization::TextRenderer::selectedText ( )

◆ setDefaultClassHandler()

static void Visualization::TextRenderer::setDefaultClassHandler ( Visualization::InteractionHandler handler)
inlinestatic

◆ setEditable()

void Visualization::TextRenderer::setEditable ( bool  editable)
inline

◆ setStyle()

void Visualization::TextRenderer::setStyle ( const Visualization::ItemStyle itemStyle)
overridevirtual

◆ setSuppressDefaultCopyPasteHandler()

void Visualization::TextRenderer::setSuppressDefaultCopyPasteHandler ( bool  suppress)
inline

◆ setText()

bool Visualization::TextRenderer::setText ( const QString &  newText)
virtual

Sets the text of this item to newText.

Returns true if the text has been set, false otherwise.

◆ setTextFormat()

void Visualization::TextRenderer::setTextFormat ( Qt::TextFormat  textFormat)

◆ staticAddOns()

QList< Visualization::VisualizationAddOn * > & Visualization::TextRenderer::staticAddOns ( )
staticprivate

◆ staticTextSize()

QSize Visualization::TextRenderer::staticTextSize ( QFontMetrics &  qfm)
inlineprivate

◆ style()

const StyleType* Visualization::TextRenderer::style ( ) const
inline

◆ text()

QString Visualization::TextRenderer::text ( )
inline

Returns the text that is currently cached in this TextRenderer item.

This is the last string that was visualized by this TextRenderer. This could be different compared to the value of the text represented by this Item. For example if this is an instance of ItemWithNode<TextRenderer, Text> and the text of the node has changed, this change is not automatically reflected. Only when the TextRenderer is updated will the new text be cached.

◆ textXOffset()

qreal Visualization::TextRenderer::textXOffset ( )
inline

◆ textYOffset()

qreal Visualization::TextRenderer::textYOffset ( )
inline

◆ updateGeometry()

void Visualization::TextRenderer::updateGeometry ( int  availableWidth,
int  availableHeight 
)
overrideprotectedvirtual

Member Data Documentation

◆ defaultClassHandler_

Visualization::InteractionHandler * Visualization::TextRenderer::defaultClassHandler_ = nullptr
staticprivate

◆ drawApproximately_

ApproximateUpdate Visualization::TextRenderer::drawApproximately_ {Unknown}
private

◆ editable_

bool Visualization::TextRenderer::editable_ {}
private

◆ MIN_TEXT_WIDTH

const int Visualization::TextRenderer::MIN_TEXT_WIDTH = 10
staticprivate

◆ staticText_

QStaticText Visualization::TextRenderer::staticText_
private

◆ suppressDefaultCopyPasteHandler_

bool Visualization::TextRenderer::suppressDefaultCopyPasteHandler_ {}
private

◆ textXOffset_

qreal Visualization::TextRenderer::textXOffset_
private

◆ textYOffset_

qreal Visualization::TextRenderer::textYOffset_
private