JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches

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

#include <jkqtmathtextwhitespacenode.h>

Inheritance diagram for JKQTMathTextWhitespaceNode:
[legend]
Collaboration diagram for JKQTMathTextWhitespaceNode:
[legend]

Classes

struct  WhitespaceProps
 describes a whitespace More...
 

Public Types

enum  Types {
  WSTNormal ,
  WSTNonbreaking ,
  WST1en ,
  WST1em ,
  WSTQuad =WST1em ,
  WSThair ,
  WSTthin ,
  WSTnegthin ,
  WSTmedium ,
  WSTnegmedium ,
  WSTthick ,
  WSTnegthick ,
  WSTthicker
}
 

Public Member Functions

 JKQTMathTextWhitespaceNode (const QString &type, JKQTMathText *parent)
 constructs a node with count=1 and the width derived from the instruction name type
 
 JKQTMathTextWhitespaceNode (const QString &type, size_t count, JKQTMathText *parent)
 constructs a node with the specified count and the width derived from the instruction name type
 
 JKQTMathTextWhitespaceNode (JKQTMathText *parent)
 constructs a node with count=1 and type=WSTNormal
 
 JKQTMathTextWhitespaceNode (Types type, JKQTMathText *parent)
 constructs a node with count=1 and the given type
 
 JKQTMathTextWhitespaceNode (Types type, size_t cound, JKQTMathText *parent)
 constructs a node with the given type and count
 
virtual ~JKQTMathTextWhitespaceNode () override
 
virtual double draw (QPainter &painter, double x, double y, JKQTMathTextEnvironment currentEv) const override
 draw the contents at the designated position
 
virtual QString getTypeName () const override
 return the name of this class as a string
 
size_t getWhitespaceCount () const
 number of whitespaces of the given type, represented by this node (default: 1)
 
Types getWhitespaceType () const
 type of the whitespace represented by this node
 
virtual bool toHtml (QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const override
 convert node to HTML and returns true on success
 
double Type2PixelWidth (Types type, JKQTMathTextEnvironment currentEv, QPaintDevice *pd) const
 converts Types type into its width in pixels, based on currentEv and pd
 
- Public Member Functions inherited from JKQTMathTextNode
 JKQTMathTextNode (const JKQTMathTextNode &)=delete
 
 JKQTMathTextNode (JKQTMathText *parentMathText)
 
virtual ~JKQTMathTextNode ()
 
bool getDrawBoxes () const
 returns the drawing of colored boxes (for DEBUGGING) around the actual output of the node is enabled
 
JKQTMathTextNodegetParentNode ()
 parent node of this node (i.e. one level up, ode nullptr )
 
const JKQTMathTextNodegetParentNode () const
 parent node of this node (i.e. one level up, ode nullptr )
 
JKQTMathTextNodeSize getSize (QPainter &painter, JKQTMathTextEnvironment currentEv) const
 determine the size of the node, calls getSizeInternal() implementation of the actual type
 
bool isSubSuperscriptAboveBelowNode () const
 if true then following sub- and/or superscripts are placed below and above the node, not besides it. This is activated when \sum\limits_{sub}^{sup} is used in LaTeX instead of simply \sum_{sub}^{sup}
 
JKQTMathTextNodeoperator= (const JKQTMathTextNode &)=delete
 
virtual void setDrawBoxes (bool draw)
 enables the drawing of colored boxes (for DEBUGGING) around the actual output of the node
 
void setParentNode (JKQTMathTextNode *node)
 parent node of this node (i.e. one level up, ode nullptr )
 
void setSubSuperscriptAboveBelowNode (bool __value)
 if true then following sub- and/or superscripts are placed below and above the node, not besides it. This is activated when \sum\limits_{sub}^{sup} is used in LaTeX instead of simply \sum_{sub}^{sup}
 

Static Public Member Functions

static bool supportsInstructionName (const QString &instruction)
 checks whether a given LaTeX instruction name is supported by this node class type
 
static QString Type2String (Types type)
 converts Types type into a string
 
- Static Public Member Functions inherited from JKQTMathTextNode
static double getNonItalicXCorretion (QPainter &painter, double width_potentiallyitalic, const JKQTMathTextEnvironment &ev_potentiallyitalic, const JKQTMathTextNode *child)
 calculates the x-size-difference between the given (probably) italic (width externally calculated: width_potentiallyitalic, ev_potentiallyitalic) and the non-italic version of child
 

Protected Member Functions

virtual JKQTMathTextNodeSize getSizeInternal (QPainter &painter, JKQTMathTextEnvironment currentEv) const override
 determine the size of the node, overwrite this function in derived classes
 
- Protected Member Functions inherited from JKQTMathTextNode
void addToErrorList (const QString &error)
 adds a new error to the JKQTMathText referenced by parentMathText
 
void doDrawBoxes (QPainter &painter, double x, double y, const JKQTMathTextNodeSize &size) const
 draws colored boxes (for DEBUGGING) around the actual output of the node
 
void doDrawBoxes (QPainter &painter, double x, double y, JKQTMathTextEnvironment currentEv) const
 draws colored boxes (for DEBUGGING) around the actual output of the node
 
template<class T >
QList< T * > getParents ()
 returns the list of parent, parent-of-parent, ... that can be cast to type T
 
template<class T >
QList< const T * > getParents () const
 returns the list of parent, parent-of-parent, ... that can be cast to type T
 

Static Protected Member Functions

static const QHash< QString, WhitespaceProps > & supportedInstructions ()
 translation table between latex instruction and WhitespaceProps
 
static QString Type2HTML (Types type)
 converts Types type into its HTML representation
 

Protected Attributes

WhitespaceProps whitespace
 properties of the whitespace represented by this node
 
- Protected Attributes inherited from JKQTMathTextNode
bool drawBoxes
 enables the drawing of colored boxes (for DEBUGGING) around the actual output of the node
 
JKQTMathTextparentMathText
 parent JKQTMathText object (required for several drawing operations
 
JKQTMathTextNodeparentNode
 parent node of this node (i.e. one level up, ode nullptr )
 
bool subSuperscriptAboveBelowNode
 if true then following sub- and/or superscripts are placed below and above the node, not besides it. This is activated when \sum\limits_{sub}^{sup} is used in LaTeX instead of simply \sum_{sub}^{sup}
 

Detailed Description

subclass representing one whitepsace node in the syntax tree

It can represent different types of spaces, see Types and different multiples of that space. so JKQTMathTextWhitespaceNode(WST1em,2,parent) will represent two 1em wide spaces, i.e. a 2em space.

Member Enumeration Documentation

◆ Types

Enumerator
WSTNormal 

a normal-width whitespace

WSTNonbreaking 

a normal-width, non-breaking whitespace

WST1en 

1en (= 0.5 * pointsize of the font) whitespace

WST1em 

1em (= pointsize of the font) whitespace

WSTQuad 

1em (= pointsize of the font) whitespace

WSThair 

hair (thinner than thin) whitespace (1/12 em = pointsize/12)

WSTthin 

thin whitespace (1/6 em = pointsize/6)

WSTnegthin 

negative thin whitespace (-1/6 em = -pointsize/6)

WSTmedium 

medium whitespace (2/9 em = pointsize*2/9)

WSTnegmedium 

negative medium whitespace (-2/9 em = -pointsize*2/9)

WSTthick 

thick whitespace (5/18 em = pointsize*5/18)

WSTnegthick 

negative thick whitespace (-5/18 em = -pointsize*5/18)

WSTthicker 

thicker whitespace (1/3 em = pointsize/3)

Constructor & Destructor Documentation

◆ JKQTMathTextWhitespaceNode() [1/5]

JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode ( JKQTMathText parent)
explicit

constructs a node with count=1 and type=WSTNormal

◆ JKQTMathTextWhitespaceNode() [2/5]

JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode ( const QString &  type,
JKQTMathText parent 
)
explicit

constructs a node with count=1 and the width derived from the instruction name type

◆ JKQTMathTextWhitespaceNode() [3/5]

JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode ( const QString &  type,
size_t  count,
JKQTMathText parent 
)
explicit

constructs a node with the specified count and the width derived from the instruction name type

◆ JKQTMathTextWhitespaceNode() [4/5]

JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode ( Types  type,
JKQTMathText parent 
)
explicit

constructs a node with count=1 and the given type

◆ JKQTMathTextWhitespaceNode() [5/5]

JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode ( Types  type,
size_t  cound,
JKQTMathText parent 
)
explicit

constructs a node with the given type and count

◆ ~JKQTMathTextWhitespaceNode()

virtual JKQTMathTextWhitespaceNode::~JKQTMathTextWhitespaceNode ( )
overridevirtual

Member Function Documentation

◆ draw()

virtual double JKQTMathTextWhitespaceNode::draw ( QPainter &  painter,
double  x,
double  y,
JKQTMathTextEnvironment  currentEv 
) const
overridevirtual

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]
currentEvJKQTMathTextEnvironment object describing the current drawing environment/settings
Returns
the x position which to use for the next part of the text

Implements JKQTMathTextNode.

◆ getSizeInternal()

virtual JKQTMathTextNodeSize JKQTMathTextWhitespaceNode::getSizeInternal ( QPainter &  painter,
JKQTMathTextEnvironment  currentEv 
) const
overrideprotectedvirtual

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

Parameters
painterpainter to use for determining the size
currentEvcurrent environment object
Returns
all important box size parameters packed as JKQTMathTextNodeSize

Implements JKQTMathTextNode.

◆ getTypeName()

virtual QString JKQTMathTextWhitespaceNode::getTypeName ( ) const
overridevirtual

return the name of this class as a string

Reimplemented from JKQTMathTextNode.

◆ getWhitespaceCount()

size_t JKQTMathTextWhitespaceNode::getWhitespaceCount ( ) const

number of whitespaces of the given type, represented by this node (default: 1)

◆ getWhitespaceType()

Types JKQTMathTextWhitespaceNode::getWhitespaceType ( ) const

type of the whitespace represented by this node

◆ supportedInstructions()

static const QHash< QString, WhitespaceProps > & JKQTMathTextWhitespaceNode::supportedInstructions ( )
staticprotected

translation table between latex instruction and WhitespaceProps

Note
This is a customization point for additional whitespace instructions!

◆ supportsInstructionName()

static bool JKQTMathTextWhitespaceNode::supportsInstructionName ( const QString &  instruction)
static

checks whether a given LaTeX instruction name is supported by this node class type

◆ toHtml()

virtual bool JKQTMathTextWhitespaceNode::toHtml ( QString &  html,
JKQTMathTextEnvironment  currentEv,
JKQTMathTextEnvironment  defaultEv 
) const
overridevirtual

convert node to HTML and returns true on success

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

Reimplemented from JKQTMathTextNode.

◆ Type2HTML()

static QString JKQTMathTextWhitespaceNode::Type2HTML ( Types  type)
staticprotected

converts Types type into its HTML representation

◆ Type2PixelWidth()

double JKQTMathTextWhitespaceNode::Type2PixelWidth ( Types  type,
JKQTMathTextEnvironment  currentEv,
QPaintDevice *  pd 
) const

converts Types type into its width in pixels, based on currentEv and pd

◆ Type2String()

static QString JKQTMathTextWhitespaceNode::Type2String ( Types  type)
static

converts Types type into a string

Member Data Documentation

◆ whitespace

WhitespaceProps JKQTMathTextWhitespaceNode::whitespace
protected

properties of the whitespace represented by this node


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