JKQTPlotter
an extensive Qt4/Qt5 Plotter framework (including a fast variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies

subclass representing one node in the syntax tree More...

#include <jkqtmathtext.h>

Inheritance diagram for JKQTMathText::MTnode:
Collaboration diagram for JKQTMathText::MTnode:

Public Member Functions

 MTnode (const MTnode &)=delete
 
 MTnode (JKQTMathText *parent)
 
virtual ~MTnode ()
 
virtual double draw (QPainter &painter, double x, double y, MTenvironment currentEv, const MTnodeSize *prevNodeSize=nullptr)=0
 draw the contents at the designated position More...
 
bool getDrawBoxes () const
 returns the drawing of colored boxes (for DEBUGGING) around the actual output of the node is enabled More...
 
void getSize (QPainter &painter, MTenvironment currentEv, double &width, double &baselineHeight, double &overallHeight, double &strikeoutPos, const MTnodeSize *prevNodeSize=nullptr)
 determine the size of the node, calls getSizeInternal() implementation of the actual type More...
 
virtual QString getTypeName () const
 return the name of this class as a string More...
 
MTnodeoperator= (const MTnode &)=delete
 
virtual void setDrawBoxes (bool draw)
 enables the drawing of colored boxes (for DEBUGGING) around the actual output of the node More...
 
virtual bool toHtml (QString &html, JKQTMathText::MTenvironment currentEv, JKQTMathText::MTenvironment defaultEv)
 convert node to HTML and returns true on success More...
 

Protected Member Functions

void doDrawBoxes (QPainter &painter, double x, double y, JKQTMathText::MTenvironment currentEv)
 draws colored boxes (for DEBUGGING) around the actual output of the node More...
 
virtual void getSizeInternal (QPainter &painter, MTenvironment currentEv, double &width, double &baselineHeight, double &overallHeight, double &strikeoutPos, const MTnodeSize *prevNodeSize=nullptr)=0
 determine the size of the node, overwrite this function in derived classes More...
 

Protected Attributes

bool drawBoxes
 enables the drawing of colored boxes (for DEBUGGING) around the actual output of the node More...
 
JKQTMathTextparent
 parent JKQTMathText object (required for several drawing operations More...
 

Detailed Description

subclass representing one node in the syntax tree

Constructor & Destructor Documentation

◆ MTnode() [1/2]

JKQTMathText::MTnode::MTnode ( JKQTMathText parent)
explicit

◆ MTnode() [2/2]

JKQTMathText::MTnode::MTnode ( const MTnode )
delete

◆ ~MTnode()

virtual JKQTMathText::MTnode::~MTnode ( )
virtual

Member Function Documentation

◆ doDrawBoxes()

void JKQTMathText::MTnode::doDrawBoxes ( QPainter &  painter,
double  x,
double  y,
JKQTMathText::MTenvironment  currentEv 
)
protected

draws colored boxes (for DEBUGGING) around the actual output of the node

Parameters
painterQPainter to use
xx-position, where the drawing starts [Pixel]
yY-position of the baseline, where the drawing starts [Pixel]
currentEvJKQTMathText::MTenvironment object describing the current drawing environment/settings

◆ draw()

virtual double JKQTMathText::MTnode::draw ( QPainter &  painter,
double  x,
double  y,
MTenvironment  currentEv,
const MTnodeSize prevNodeSize = nullptr 
)
pure virtual

draw the contents at the designated position

Parameters
painterQPainter to use
xx-position, where the drawing starts [Pixel]
yY-position of the baseline, where the drawing starts [Pixel]
currentEvJKQTMathText::MTenvironment object describing the current drawing environment/settings
[in]prevNodeSizeoptional parameter, describing the size of the previous node (on the left). This may be used for layout of some nodes (e.g. sub/super to move correctly next to large parantheses ...)
Returns
the x position which to use for the next part of the text

Implemented in JKQTMathText::MTdecoratedNode, JKQTMathText::MTmatrixNode, JKQTMathText::MTfracNode, JKQTMathText::MTsqrtNode, JKQTMathText::MTbraceNode, JKQTMathText::MTsuperscriptNode, JKQTMathText::MTsubscriptNode, JKQTMathText::MTinstruction1Node, JKQTMathText::MTlistNode, JKQTMathText::MTsymbolNode, and JKQTMathText::MTtextNode.

◆ getDrawBoxes()

bool JKQTMathText::MTnode::getDrawBoxes ( ) const

returns the drawing of colored boxes (for DEBUGGING) around the actual output of the node is enabled

◆ getSize()

void JKQTMathText::MTnode::getSize ( QPainter &  painter,
MTenvironment  currentEv,
double &  width,
double &  baselineHeight,
double &  overallHeight,
double &  strikeoutPos,
const MTnodeSize prevNodeSize = nullptr 
)

determine the size of the node, calls getSizeInternal() implementation of the actual type

See also
getSizeInternal()
Parameters
painterpainter to use for determining the size
currentEvcurrent environment object
[out]widthwidth of the block/node
[out]baselineHeightdistance from the bottom of the block/node-box to the baseline
[out]overallHeightoverall height (bottom to top) of the node, the ascent is overallHeight-baselineHeight
[out]strikeoutPosposition of the strikeout-line
[in]prevNodeSizeoptional parameter, describing the size of the previous node (on the left). This may be used for layout of some nodes (e.g. sub/super to move correctly next to large parantheses ...)

◆ getSizeInternal()

virtual void JKQTMathText::MTnode::getSizeInternal ( QPainter &  painter,
MTenvironment  currentEv,
double &  width,
double &  baselineHeight,
double &  overallHeight,
double &  strikeoutPos,
const MTnodeSize prevNodeSize = nullptr 
)
protectedpure virtual

determine the size of the node, overwrite this function in derived classes

Parameters
painterpainter to use for determining the size
currentEvcurrent environment object
[out]widthwidth of the block/node
[out]baselineHeightdistance from the bottom of the block/node-box to the baseline
[out]overallHeightoverall height (bottom to top) of the node, the ascent is overallHeight-baselineHeight
[out]strikeoutPosposition of the strikeout-line
[in]prevNodeSizeoptional parameter, describing the size of the previous node (on the left). This may be used for layout of some nodes (e.g. sub/super to move correctly next to large parantheses ...)

Implemented in JKQTMathText::MTdecoratedNode, JKQTMathText::MTmatrixNode, JKQTMathText::MTfracNode, JKQTMathText::MTsqrtNode, JKQTMathText::MTbraceNode, JKQTMathText::MTsuperscriptNode, JKQTMathText::MTsubscriptNode, JKQTMathText::MTinstruction1Node, JKQTMathText::MTlistNode, JKQTMathText::MTsymbolNode, and JKQTMathText::MTtextNode.

◆ getTypeName()

◆ operator=()

MTnode& JKQTMathText::MTnode::operator= ( const MTnode )
delete

◆ setDrawBoxes()

virtual void JKQTMathText::MTnode::setDrawBoxes ( bool  draw)
virtual

◆ toHtml()

virtual bool JKQTMathText::MTnode::toHtml ( QString &  html,
JKQTMathText::MTenvironment  currentEv,
JKQTMathText::MTenvironment  defaultEv 
)
virtual

convert node to HTML and returns true on success

Parameters
[out]htmlnew HTML code is APPENDED to this string
currentEvJKQTMathText::MTenvironment object describing the current drawing environment/settings
defaultEvJKQTMathText::MTenvironment object describing the default drawing environment/settings when starting to interpret a node tree
Returns
true on success

Reimplemented in JKQTMathText::MTdecoratedNode, JKQTMathText::MTmatrixNode, JKQTMathText::MTfracNode, JKQTMathText::MTsqrtNode, JKQTMathText::MTbraceNode, JKQTMathText::MTsuperscriptNode, JKQTMathText::MTsubscriptNode, JKQTMathText::MTinstruction1Node, JKQTMathText::MTlistNode, JKQTMathText::MTsymbolNode, JKQTMathText::MTwhitespaceNode, and JKQTMathText::MTtextNode.

Member Data Documentation

◆ drawBoxes

bool JKQTMathText::MTnode::drawBoxes
protected

enables the drawing of colored boxes (for DEBUGGING) around the actual output of the node

◆ parent

JKQTMathText* JKQTMathText::MTnode::parent
protected

parent JKQTMathText object (required for several drawing operations


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