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 a \frac node More...

#include <jkqtmathtextfracnode.h>

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

Public Types

enum  FracType {
  MTFMfrac ,
  MTFMdfrac ,
  MTFMtfrac ,
  MTFMsfrac ,
  MTFMstfrac ,
  MTFMunderbrace ,
  MTFMoverbrace ,
  MTFMunderbracket ,
  MTFMoverbracket ,
  MTFMstackrel ,
  MTFMunderset ,
  MTFMoverset
}
 type of ffractions represented by JKQTMathTextFracNode More...

Public Member Functions

 JKQTMathTextFracNode (JKQTMathText *parent, JKQTMathTextNode *child_top, JKQTMathTextNode *child_bottom, JKQTMathTextFracNode::FracType mode)
virtual ~JKQTMathTextFracNode () override
virtual double draw (QPainter &painter, double x, double y, JKQTMathTextEnvironment currentEv) const override
 draw the contents at the designated position
JKQTMathTextFracNode::FracType getMode () const
 actual display type of fraction object
virtual QString getTypeName () const override
 return the name of this class as a string
virtual bool toHtml (QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const override
 convert node to HTML and returns true on success
Public Member Functions inherited from JKQTMathTextDualChildNode
 JKQTMathTextDualChildNode (JKQTMathTextNode *_child1, JKQTMathTextNode *_child2, JKQTMathText *parentMathText)
virtual ~JKQTMathTextDualChildNode () override
virtual int childCount () const override
 returns the i-th child node
virtual void clearChildren (bool deleteChildren=true) override
 returns the i-th child node
virtual void deleteChild (int i) override
 delete the i-th child
virtual const JKQTMathTextNodegetChild (int i) const override
 returns the i-th child node
virtual JKQTMathTextNodegetChild (int i) override
 returns the i-th child node
JKQTMathTextNodegetChild1 ()
 first child node of this node
const JKQTMathTextNodegetChild1 () const
 first child node of this node
JKQTMathTextNodegetChild2 ()
 second child node of this node
const JKQTMathTextNodegetChild2 () const
 second child node of this node
virtual JKQTMathTextNodereplaceChild (int i, JKQTMathTextNode *newChild) override
 returns the i-th child node
Public Member Functions inherited from JKQTMathTextMultiChildNode
 JKQTMathTextMultiChildNode (JKQTMathText *parentMathText)
virtual ~JKQTMathTextMultiChildNode () override
virtual QList< JKQTMathTextNode * > getChildren ()
 returns a list of all child node
virtual QList< const JKQTMathTextNode * > getChildren () const
 returns a list of all child node
virtual JKQTMathTextNodegetFirstChild ()
 returns the first child node
virtual const JKQTMathTextNodegetFirstChild () const
 returns the first child node
virtual JKQTMathTextNodegetLastChild ()
 returns the last child node
virtual const JKQTMathTextNodegetLastChild () const
 returns the last child node
bool hasChildren () const
 returns true if children exist
bool isEmpty () const
 returns true if there are no children
virtual void replaceAndDeleteChild (int i, JKQTMathTextNode *newChild)
 replaces the i-th child node with the node newChild , deletes the replaced old node
virtual void setDrawBoxes (bool draw) override
 enables the drawing of colored boxes (for DEBUGGING) around the actual output of the node
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
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 QString FracType2String (FracType mode)
 convert a JKQTMathTextFracNode::FracType into a QString
static FracType InstructionName2FracType (const QString &mode)
 returns the FracType corresponding to instructionName
static bool supportsInstructionName (const QString &instructionName)
 returns true, if the given instructionName can be converted to a FracType
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

double getFracScalingFactor () const
 determines the scaling factor of the fraction (takes into account the nesting level)
int getNestingLevel (bool sameType=false) const
 returns the nesting level of the node (of same type of sameType ==true)
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, FracType > & instructions ()
 lists all supported instructions

Protected Attributes

JKQTMathTextFracNode::FracType mode
 actual display type of fraction object
Protected Attributes inherited from JKQTMathTextDualChildNode
JKQTMathTextNodechild1
 first child node of this node
JKQTMathTextNodechild2
 second child node of 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 a \frac node

all fractions re drawn like this:

slanted fractions are drawn like this:

Member Enumeration Documentation

◆ FracType

type of ffractions represented by JKQTMathTextFracNode

See also
JKQTMathTextFracNode, JKQTMathTextFracNode::FracType2String()
Enumerator
MTFMfrac 

normal fraction

MTFMdfrac 

normal fraction, without scaling of under/over text

MTFMtfrac 

text fraction (smaller than MTFMfrac)

MTFMsfrac 

slanted fraction

MTFMstfrac 

slanted text fraction

MTFMunderbrace 

curly underbrace

MTFMoverbrace 

curly overbrace

MTFMunderbracket 

square underbracket

MTFMoverbracket 

square overbracket

MTFMstackrel 

binom/fraction without line

MTFMunderset 

underset text

MTFMoverset 

overset text

Constructor & Destructor Documentation

◆ JKQTMathTextFracNode()

JKQTMathTextFracNode::JKQTMathTextFracNode ( JKQTMathText * parent,
JKQTMathTextNode * child_top,
JKQTMathTextNode * child_bottom,
JKQTMathTextFracNode::FracType mode )

◆ ~JKQTMathTextFracNode()

virtual JKQTMathTextFracNode::~JKQTMathTextFracNode ( )
overridevirtual

Member Function Documentation

◆ draw()

virtual double JKQTMathTextFracNode::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.

◆ FracType2String()

QString JKQTMathTextFracNode::FracType2String ( FracType mode)
static

◆ getFracScalingFactor()

double JKQTMathTextFracNode::getFracScalingFactor ( ) const
protected

determines the scaling factor of the fraction (takes into account the nesting level)

◆ getMode()

JKQTMathTextFracNode::FracType JKQTMathTextFracNode::getMode ( ) const

actual display type of fraction object

◆ getNestingLevel()

int JKQTMathTextFracNode::getNestingLevel ( bool sameType = false) const
protected

returns the nesting level of the node (of same type of sameType ==true)

◆ getSizeInternal()

virtual JKQTMathTextNodeSize JKQTMathTextFracNode::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 JKQTMathTextFracNode::getTypeName ( ) const
overridevirtual

return the name of this class as a string

Reimplemented from JKQTMathTextNode.

◆ InstructionName2FracType()

FracType JKQTMathTextFracNode::InstructionName2FracType ( const QString & mode)
static

returns the FracType corresponding to instructionName

See also
JKQTMathTextFracNode::FracType

◆ instructions()

const QHash< QString, FracType > & JKQTMathTextFracNode::instructions ( )
staticprotected

lists all supported instructions

◆ supportsInstructionName()

bool JKQTMathTextFracNode::supportsInstructionName ( const QString & instructionName)
static

returns true, if the given instructionName can be converted to a FracType

See also
JKQTMathTextFracNode::FracType

◆ toHtml()

virtual bool JKQTMathTextFracNode::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.

Member Data Documentation

◆ mode

JKQTMathTextFracNode::FracType JKQTMathTextFracNode::mode
protected

actual display type of fraction object


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