From f7ad259aeb8e6c9524178b2cab571266643d1ded Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Sun, 7 Aug 2022 17:48:05 +0200 Subject: [PATCH] JKQTMathText: added JKATMathTextNode::getSize()-Variant with struct return value --- lib/jkqtmathtext/nodes/jkqtmathtextnode.cpp | 7 +++++++ lib/jkqtmathtext/nodes/jkqtmathtextnode.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/jkqtmathtext/nodes/jkqtmathtextnode.cpp b/lib/jkqtmathtext/nodes/jkqtmathtextnode.cpp index d5a6dce5b7..1fd9fdfb9d 100644 --- a/lib/jkqtmathtext/nodes/jkqtmathtextnode.cpp +++ b/lib/jkqtmathtext/nodes/jkqtmathtextnode.cpp @@ -361,3 +361,10 @@ void JKQTMathTextMultiChildNode::setDrawBoxes(bool draw) } } + +JKQTMathTextNodeSize JKQTMathTextNode::getSize(QPainter &painter, JKQTMathTextEnvironment currentEv, const JKQTMathTextNodeSize *prevNodeSize) +{ + JKQTMathTextNodeSize s; + getSize(painter, currentEv, s.width, s.baselineHeight, s.overallHeight, s.strikeoutPos, prevNodeSize); + return s; +} diff --git a/lib/jkqtmathtext/nodes/jkqtmathtextnode.h b/lib/jkqtmathtext/nodes/jkqtmathtextnode.h index 0be4bbc424..b80b7ed0f1 100644 --- a/lib/jkqtmathtext/nodes/jkqtmathtextnode.h +++ b/lib/jkqtmathtext/nodes/jkqtmathtextnode.h @@ -52,6 +52,14 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextNode { * */ void getSize(QPainter& painter, JKQTMathTextEnvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const JKQTMathTextNodeSize* prevNodeSize=nullptr); + /** \brief determine the size of the node, calls getSizeInternal() implementation of the actual type \see getSizeInternal() + * + * \param painter painter to use for determining the size + * \param currentEv current environment object + * \param[in] prevNodeSize optional 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 ...) + * + */ + JKQTMathTextNodeSize getSize(QPainter& painter, JKQTMathTextEnvironment currentEv, const JKQTMathTextNodeSize* prevNodeSize=nullptr); /** \brief calculates the x-size-difference between the given (probably) italic (width externally calculated: \a width_potentiallyitalic, \a ev_potentiallyitalic) and the non-italic version of \a child */ double getNonItalicXCorretion(QPainter &painter, double width_potentiallyitalic, const JKQTMathTextEnvironment &ev_potentiallyitalic, JKQTMathTextNode* child) const; /** \brief draw the contents at the designated position