Text¶
QwtText¶
-
class
qwt.text.
QwtText
(text=None, textFormat=None, other=None)[source]¶ A class representing a text
A QwtText is a text including a set of attributes how to render it.
- Format:
A text might include control sequences (f.e tags) describing how to render it. Each format (f.e MathML, TeX, Qt Rich Text) has its own set of control sequences, that can be handles by a special QwtTextEngine for this format.
- Background:
A text might have a background, defined by a QPen and QBrush to improve its visibility. The corners of the background might be rounded.
- Font:
A text might have an individual font.
- Color
A text might have an individual color.
- Render Flags
Flags from Qt.AlignmentFlag and Qt.TextFlag used like in QPainter.drawText().
..seealso:
:py:meth:`qwt.text_engine.QwtTextEngine`, :py:meth:`qwt.text.QwtTextLabel`
Text formats:
QwtText.AutoText:
The text format is determined using QwtTextEngine.mightRender() for all available text engines in increasing order > PlainText. If none of the text engines can render the text is rendered like QwtText.PlainText.
QwtText.PlainText:
Draw the text as it is, using a QwtPlainTextEngine.
QwtText.RichText:
Use the Scribe framework (Qt Rich Text) to render the text.
QwtText.MathMLText:
Use a MathML (http://en.wikipedia.org/wiki/MathML) render engine to display the text. The Qwt MathML extension offers such an engine based on the MathML renderer of the Qt solutions package. To enable MathML support the following code needs to be added to the application:
QwtText.setTextEngine(QwtText.MathMLText, QwtMathMLTextEngine())
QwtText.TeXText:
Use a TeX (http://en.wikipedia.org/wiki/TeX) render engine to display the text ( not implemented yet ).
QwtText.OtherFormat:
The number of text formats can be extended using setTextEngine. Formats >= QwtText.OtherFormat are not used by Qwt.
Paint attributes:
- QwtText.PaintUsingTextFont: The text has an individual font.
- QwtText.PaintUsingTextColor: The text has an individual color.
- QwtText.PaintBackground: The text has an individual background.
Layout attributes:
QwtText.MinimumLayout:
Layout the text without its margins. This mode is useful if a text needs to be aligned accurately, like the tick labels of a scale. If QwtTextEngine.textMargins is not implemented for the format of the text, MinimumLayout has no effect.
-
class
QwtText
([text=None][, textFormat=None][, other=None])¶ Parameters: - text (str) – Text content
- textFormat (int) – Text format
- other (qwt.text.QwtText) – Object to copy (text and textFormat arguments are ignored)
-
QwtText.
setText
(text, textFormat=None)[source]¶ Assign a new text content
Parameters: - text (str) – Text content
- textFormat (int) – Text format
See also
-
QwtText.
setRenderFlags
(renderFlags)[source]¶ Change the render flags
The default setting is Qt.AlignCenter
Parameters: renderFlags (int) – Bitwise OR of the flags used like in QPainter.drawText()
-
QwtText.
setFont
(font)[source]¶ Set the font.
Parameters: font (QFont) – Font Note
Setting the font might have no effect, when the text contains control sequences for setting fonts.
See also
-
QwtText.
usedFont
(defaultFont)[source]¶ Return the font of the text, if it has one. Otherwise return defaultFont.
Parameters: defaultFont (QFont) – Default font Returns: Font used for drawing the text
-
QwtText.
setColor
(color)[source]¶ Set the pen color used for drawing the text.
Parameters: color (QColor) – Color Note
Setting the color might have no effect, when the text contains control sequences for setting colors.
See also
-
QwtText.
usedColor
(defaultColor)[source]¶ Return the color of the text, if it has one. Otherwise return defaultColor.
Parameters: defaultColor (QColor) – Default color Returns: Color used for drawing the text See also
-
QwtText.
setBorderRadius
(radius)[source]¶ Set the radius for the corners of the border frame
Parameters: radius (float) – Radius of a rounded corner See also
-
QwtText.
setBorderPen
(pen)[source]¶ Set the background pen
Parameters: pen (QPen) – Background pen See also
-
QwtText.
setBackgroundBrush
(brush)[source]¶ Set the background brush
Parameters: brush (QBrush) – Background brush See also
-
QwtText.
setPaintAttribute
(attribute, on=True)[source]¶ Change a paint attribute
Parameters: - attribute (int) – Paint attribute
- on (bool) – On/Off
Note
Used by setFont(), setColor(), setBorderPen() and setBackgroundBrush()
See also
-
QwtText.
testPaintAttribute
(attribute)[source]¶ Test a paint attribute
Parameters: attribute (int) – Paint attribute Returns: True, if attribute is enabled See also
-
QwtText.
setLayoutAttribute
(attribute, on=True)[source]¶ Change a layout attribute
Parameters: - attribute (int) – Layout attribute
- on (bool) – On/Off
See also
-
QwtText.
testLayoutAttribute
(attribute)[source]¶ Test a layout attribute
Parameters: attribute (int) – Layout attribute Returns: True, if attribute is enabled See also
-
QwtText.
heightForWidth
(width, defaultFont=None)[source]¶ Find the height for a given width
Parameters: - width (float) – Width
- defaultFont (QFont) – Font, used for the calculation if the text has no font
Returns: Calculated height
-
QwtText.
textSize
(defaultFont)[source]¶ Returns the size, that is needed to render text
:param QFont defaultFont Font, used for the calculation if the text has no font :return: Caluclated size
-
QwtText.
draw
(painter, rect)[source]¶ Draw a text into a rectangle
Parameters: - painter (QPainter) – Painter
- rect (QRectF) – Rectangle
-
QwtText.
textEngine
(*args)[source]¶ Find the text engine for a text format
In case of QwtText.AutoText the first text engine (beside QwtPlainTextEngine) is returned, where QwtTextEngine.mightRender returns true. If there is none QwtPlainTextEngine is returned.
If no text engine is registered for the format QwtPlainTextEngine is returned.
Parameters: - text (str) – Text, needed in case of AutoText
- format (int) – Text format
Returns: Corresponding text engine
-
QwtText.
setTextEngine
(format_, engine)[source]¶ Assign/Replace a text engine for a text format
With setTextEngine it is possible to extend python-qwt with other types of text formats.
For QwtText.PlainText it is not allowed to assign a engine to None.
Parameters: - format (int) – Text format
- engine (qwt.text_engine.QwtTextEngine) – Text engine
See also
Warning
Using QwtText.AutoText does nothing.
QwtTextLabel¶
-
class
qwt.text.
QwtTextLabel
(*args)[source]¶ A Widget which displays a QwtText
-
class
QwtTextLabel
(parent)¶ Parameters: parent (QWidget) – Parent widget
-
class
qwt.text.
QwtTextLabel
([text=None][, parent=None])[source] Parameters: - text (str) – Text
- parent (QWidget) – Parent widget
-
QwtTextLabel.
setPlainText
(text)[source]¶ Interface for the designer plugin - does the same as setText()
Parameters: text (str) – Text See also
-
QwtTextLabel.
plainText
()[source]¶ Interface for the designer plugin
Returns: Text as plain text See also
-
QwtTextLabel.
setText
(text, textFormat=0)[source]¶ Change the label’s text, keeping all other QwtText attributes
Parameters: - text (qwt.text.QwtText or str) – New text
- textFormat (int) – Format of text
See also
-
QwtTextLabel.
setIndent
(indent)[source]¶ Set label’s text indent in pixels
Parameters: indent (int) – Indentation in pixels See also
-
QwtTextLabel.
setMargin
(margin)[source]¶ Set label’s margin in pixels
Parameters: margin (int) – Margin in pixels See also
-
QwtTextLabel.
heightForWidth
(width)[source]¶ Parameters: width (int) – Width Returns: Preferred height for this widget, given the width.
-
QwtTextLabel.
drawContents
(painter)[source]¶ Redraw the text and focus indicator
Parameters: painter (QPainter) – Painter
-
class
-
class
qwt.text.
QwtText
(text=None, textFormat=None, other=None)[source] A class representing a text
A QwtText is a text including a set of attributes how to render it.
- Format:
A text might include control sequences (f.e tags) describing how to render it. Each format (f.e MathML, TeX, Qt Rich Text) has its own set of control sequences, that can be handles by a special QwtTextEngine for this format.
- Background:
A text might have a background, defined by a QPen and QBrush to improve its visibility. The corners of the background might be rounded.
- Font:
A text might have an individual font.
- Color
A text might have an individual color.
- Render Flags
Flags from Qt.AlignmentFlag and Qt.TextFlag used like in QPainter.drawText().
..seealso:
:py:meth:`qwt.text_engine.QwtTextEngine`, :py:meth:`qwt.text.QwtTextLabel`
Text formats:
QwtText.AutoText:
The text format is determined using QwtTextEngine.mightRender() for all available text engines in increasing order > PlainText. If none of the text engines can render the text is rendered like QwtText.PlainText.
QwtText.PlainText:
Draw the text as it is, using a QwtPlainTextEngine.
QwtText.RichText:
Use the Scribe framework (Qt Rich Text) to render the text.
QwtText.MathMLText:
Use a MathML (http://en.wikipedia.org/wiki/MathML) render engine to display the text. The Qwt MathML extension offers such an engine based on the MathML renderer of the Qt solutions package. To enable MathML support the following code needs to be added to the application:
QwtText.setTextEngine(QwtText.MathMLText, QwtMathMLTextEngine())
QwtText.TeXText:
Use a TeX (http://en.wikipedia.org/wiki/TeX) render engine to display the text ( not implemented yet ).
QwtText.OtherFormat:
The number of text formats can be extended using setTextEngine. Formats >= QwtText.OtherFormat are not used by Qwt.
Paint attributes:
- QwtText.PaintUsingTextFont: The text has an individual font.
- QwtText.PaintUsingTextColor: The text has an individual color.
- QwtText.PaintBackground: The text has an individual background.
Layout attributes:
QwtText.MinimumLayout:
Layout the text without its margins. This mode is useful if a text needs to be aligned accurately, like the tick labels of a scale. If QwtTextEngine.textMargins is not implemented for the format of the text, MinimumLayout has no effect.
-
class
QwtText
([text=None][, textFormat=None][, other=None]) Parameters: - text (str) – Text content
- textFormat (int) – Text format
- other (qwt.text.QwtText) – Object to copy (text and textFormat arguments are ignored)
-
QwtText.
isEmpty
()[source] Returns: True if text is empty
-
QwtText.
setText
(text, textFormat=None)[source] Assign a new text content
Parameters: - text (str) – Text content
- textFormat (int) – Text format
See also
-
QwtText.
setRenderFlags
(renderFlags)[source] Change the render flags
The default setting is Qt.AlignCenter
Parameters: renderFlags (int) – Bitwise OR of the flags used like in QPainter.drawText()
-
QwtText.
renderFlags
()[source] Returns: Render flags See also
-
QwtText.
setFont
(font)[source] Set the font.
Parameters: font (QFont) – Font Note
Setting the font might have no effect, when the text contains control sequences for setting fonts.
See also
-
QwtText.
font
()[source] Returns: Return the font See also
-
QwtText.
usedFont
(defaultFont)[source] Return the font of the text, if it has one. Otherwise return defaultFont.
Parameters: defaultFont (QFont) – Default font Returns: Font used for drawing the text
-
QwtText.
setColor
(color)[source] Set the pen color used for drawing the text.
Parameters: color (QColor) – Color Note
Setting the color might have no effect, when the text contains control sequences for setting colors.
See also
-
QwtText.
color
()[source] Returns: Return the pen color, used for painting the text See also
-
QwtText.
usedColor
(defaultColor)[source] Return the color of the text, if it has one. Otherwise return defaultColor.
Parameters: defaultColor (QColor) – Default color Returns: Color used for drawing the text See also
-
QwtText.
setBorderRadius
(radius)[source] Set the radius for the corners of the border frame
Parameters: radius (float) – Radius of a rounded corner See also
-
QwtText.
borderRadius
()[source] Returns: Radius for the corners of the border frame See also
-
QwtText.
setBorderPen
(pen)[source] Set the background pen
Parameters: pen (QPen) – Background pen See also
-
QwtText.
borderPen
()[source] Returns: Background pen See also
-
QwtText.
setBackgroundBrush
(brush)[source] Set the background brush
Parameters: brush (QBrush) – Background brush See also
-
QwtText.
backgroundBrush
()[source] Returns: Background brush See also
-
QwtText.
setPaintAttribute
(attribute, on=True)[source] Change a paint attribute
Parameters: - attribute (int) – Paint attribute
- on (bool) – On/Off
Note
Used by setFont(), setColor(), setBorderPen() and setBackgroundBrush()
See also
-
QwtText.
testPaintAttribute
(attribute)[source] Test a paint attribute
Parameters: attribute (int) – Paint attribute Returns: True, if attribute is enabled See also
-
QwtText.
setLayoutAttribute
(attribute, on=True)[source] Change a layout attribute
Parameters: - attribute (int) – Layout attribute
- on (bool) – On/Off
See also
-
QwtText.
testLayoutAttribute
(attribute)[source] Test a layout attribute
Parameters: attribute (int) – Layout attribute Returns: True, if attribute is enabled See also
-
QwtText.
heightForWidth
(width, defaultFont=None)[source] Find the height for a given width
Parameters: - width (float) – Width
- defaultFont (QFont) – Font, used for the calculation if the text has no font
Returns: Calculated height
-
QwtText.
textSize
(defaultFont)[source] Returns the size, that is needed to render text
:param QFont defaultFont Font, used for the calculation if the text has no font :return: Caluclated size
-
QwtText.
draw
(painter, rect)[source] Draw a text into a rectangle
Parameters: - painter (QPainter) – Painter
- rect (QRectF) – Rectangle
-
QwtText.
textEngine
(*args)[source] Find the text engine for a text format
In case of QwtText.AutoText the first text engine (beside QwtPlainTextEngine) is returned, where QwtTextEngine.mightRender returns true. If there is none QwtPlainTextEngine is returned.
If no text engine is registered for the format QwtPlainTextEngine is returned.
Parameters: - text (str) – Text, needed in case of AutoText
- format (int) – Text format
Returns: Corresponding text engine
-
QwtText.
setTextEngine
(format_, engine)[source] Assign/Replace a text engine for a text format
With setTextEngine it is possible to extend python-qwt with other types of text formats.
For QwtText.PlainText it is not allowed to assign a engine to None.
Parameters: - format (int) – Text format
- engine (qwt.text_engine.QwtTextEngine) – Text engine
See also
Warning
Using QwtText.AutoText does nothing.
-
class
qwt.text.
QwtTextLabel
(*args)[source] A Widget which displays a QwtText
-
class
QwtTextLabel
(parent) Parameters: parent (QWidget) – Parent widget
-
class
qwt.text.
QwtTextLabel
([text=None][, parent=None])[source] Parameters: - text (str) – Text
- parent (QWidget) – Parent widget
-
QwtTextLabel.
setPlainText
(text)[source] Interface for the designer plugin - does the same as setText()
Parameters: text (str) – Text See also
-
QwtTextLabel.
plainText
()[source] Interface for the designer plugin
Returns: Text as plain text See also
-
QwtTextLabel.
setText
(text, textFormat=0)[source] Change the label’s text, keeping all other QwtText attributes
Parameters: - text (qwt.text.QwtText or str) – New text
- textFormat (int) – Format of text
See also
-
QwtTextLabel.
clear
()[source] Clear the text and all QwtText attributes
-
QwtTextLabel.
indent
()[source] Returns: Label’s text indent in pixels See also
-
QwtTextLabel.
setIndent
(indent)[source] Set label’s text indent in pixels
Parameters: indent (int) – Indentation in pixels See also
-
QwtTextLabel.
margin
()[source] Returns: Label’s text indent in pixels See also
-
QwtTextLabel.
setMargin
(margin)[source] Set label’s margin in pixels
Parameters: margin (int) – Margin in pixels See also
-
QwtTextLabel.
sizeHint
()[source] Return a size hint
-
QwtTextLabel.
minimumSizeHint
()[source] Return a minimum size hint
-
QwtTextLabel.
heightForWidth
(width)[source] Parameters: width (int) – Width Returns: Preferred height for this widget, given the width.
-
QwtTextLabel.
drawContents
(painter)[source] Redraw the text and focus indicator
Parameters: painter (QPainter) – Painter
-
QwtTextLabel.
drawText
(painter, textRect)[source] Redraw the text
Parameters: - painter (QPainter) – Painter
- textRect (QRectF) – Text rectangle
-
QwtTextLabel.
textRect
()[source] Calculate geometry for the text in widget coordinates
Returns: Geometry for the text
-
class
Text engine¶
QwtTextEngine¶
-
class
qwt.text_engine.
QwtTextEngine
[source]¶ Abstract base class for rendering text strings
A text engine is responsible for rendering texts for a specific text format. They are used by QwtText to render a text.
QwtPlainTextEngine and QwtRichTextEngine are part of the python-qwt library. The implementation of QwtMathMLTextEngine uses code from the Qt solution package. Because of license implications it is built into a separate library.
See also
-
heightForWidth
(font, flags, text, width)[source]¶ Find the height for a given width
Parameters: - font (QFont) – Font of the text
- flags (int) – Bitwise OR of the flags used like in QPainter::drawText
- text (str) – Text to be rendered
- width (float) – Width
Returns: Calculated height
-
textSize
(font, flags, text)[source]¶ Returns the size, that is needed to render text
Parameters: - font (QFont) – Font of the text
- flags (int) – Bitwise OR of the flags like in for QPainter::drawText
- text (str) – Text to be rendered
Returns: Calculated size
-
mightRender
(text)[source]¶ Test if a string can be rendered by this text engine
Parameters: text (str) – Text to be tested Returns: True, if it can be rendered
-
textMargins
(font)[source]¶ Return margins around the texts
The textSize might include margins around the text, like QFontMetrics::descent(). In situations where texts need to be aligned in detail, knowing these margins might improve the layout calculations.
Parameters: font (QFont) – Font of the text Returns: tuple (left, right, top, bottom) representing margins
-
QwtPlainTextEngine¶
-
class
qwt.text_engine.
QwtPlainTextEngine
[source]¶ A text engine for plain texts
QwtPlainTextEngine renders texts using the basic Qt classes QPainter and QFontMetrics.
-
heightForWidth
(font, flags, text, width)[source]¶ Find the height for a given width
Parameters: - font (QFont) – Font of the text
- flags (int) – Bitwise OR of the flags used like in QPainter::drawText
- text (str) – Text to be rendered
- width (float) – Width
Returns: Calculated height
-
textSize
(font, flags, text)[source]¶ Returns the size, that is needed to render text
Parameters: - font (QFont) – Font of the text
- flags (int) – Bitwise OR of the flags like in for QPainter::drawText
- text (str) – Text to be rendered
Returns: Calculated size
-
textMargins
(font)[source]¶ Return margins around the texts
The textSize might include margins around the text, like QFontMetrics::descent(). In situations where texts need to be aligned in detail, knowing these margins might improve the layout calculations.
Parameters: font (QFont) – Font of the text Returns: tuple (left, right, top, bottom) representing margins
-
QwtRichTextEngine¶
-
class
qwt.text_engine.
QwtRichTextEngine
[source]¶ A text engine for Qt rich texts
QwtRichTextEngine renders Qt rich texts using the classes of the Scribe framework of Qt.
-
heightForWidth
(font, flags, text, width)[source]¶ Find the height for a given width
Parameters: - font (QFont) – Font of the text
- flags (int) – Bitwise OR of the flags used like in QPainter::drawText
- text (str) – Text to be rendered
- width (float) – Width
Returns: Calculated height
-
textSize
(font, flags, text)[source]¶ Returns the size, that is needed to render text
Parameters: - font (QFont) – Font of the text
- flags (int) – Bitwise OR of the flags like in for QPainter::drawText
- text (str) – Text to be rendered
Returns: Calculated size
-
draw
(painter, rect, flags, text)[source]¶ Draw the text in a clipping rectangle
Parameters: - painter (QPainter) – Painter
- rect (QRectF) – Clipping rectangle
- flags (int) – Bitwise OR of the flags like in for QPainter::drawText()
- text (str) – Text to be rendered
-
mightRender
(text)[source]¶ Test if a string can be rendered by this text engine
Parameters: text (str) – Text to be tested Returns: True, if it can be rendered
-
textMargins
(font)[source]¶ Return margins around the texts
The textSize might include margins around the text, like QFontMetrics::descent(). In situations where texts need to be aligned in detail, knowing these margins might improve the layout calculations.
Parameters: font (QFont) – Font of the text Returns: tuple (left, right, top, bottom) representing margins
-
-
class
qwt.text_engine.
QwtTextEngine
[source] Abstract base class for rendering text strings
A text engine is responsible for rendering texts for a specific text format. They are used by QwtText to render a text.
QwtPlainTextEngine and QwtRichTextEngine are part of the python-qwt library. The implementation of QwtMathMLTextEngine uses code from the Qt solution package. Because of license implications it is built into a separate library.
See also
-
heightForWidth
(font, flags, text, width)[source] Find the height for a given width
Parameters: - font (QFont) – Font of the text
- flags (int) – Bitwise OR of the flags used like in QPainter::drawText
- text (str) – Text to be rendered
- width (float) – Width
Returns: Calculated height
-
textSize
(font, flags, text)[source] Returns the size, that is needed to render text
Parameters: - font (QFont) – Font of the text
- flags (int) – Bitwise OR of the flags like in for QPainter::drawText
- text (str) – Text to be rendered
Returns: Calculated size
-
mightRender
(text)[source] Test if a string can be rendered by this text engine
Parameters: text (str) – Text to be tested Returns: True, if it can be rendered
-
textMargins
(font)[source] Return margins around the texts
The textSize might include margins around the text, like QFontMetrics::descent(). In situations where texts need to be aligned in detail, knowing these margins might improve the layout calculations.
Parameters: font (QFont) – Font of the text Returns: tuple (left, right, top, bottom) representing margins
-
draw
(painter, rect, flags, text)[source] Draw the text in a clipping rectangle
Parameters: - painter (QPainter) – Painter
- rect (QRectF) – Clipping rectangle
- flags (int) – Bitwise OR of the flags like in for QPainter::drawText()
- text (str) – Text to be rendered
-
-
class
qwt.text_engine.
QwtPlainTextEngine
[source] A text engine for plain texts
QwtPlainTextEngine renders texts using the basic Qt classes QPainter and QFontMetrics.
-
heightForWidth
(font, flags, text, width)[source] Find the height for a given width
Parameters: - font (QFont) – Font of the text
- flags (int) – Bitwise OR of the flags used like in QPainter::drawText
- text (str) – Text to be rendered
- width (float) – Width
Returns: Calculated height
-
textSize
(font, flags, text)[source] Returns the size, that is needed to render text
Parameters: - font (QFont) – Font of the text
- flags (int) – Bitwise OR of the flags like in for QPainter::drawText
- text (str) – Text to be rendered
Returns: Calculated size
-
textMargins
(font)[source] Return margins around the texts
The textSize might include margins around the text, like QFontMetrics::descent(). In situations where texts need to be aligned in detail, knowing these margins might improve the layout calculations.
Parameters: font (QFont) – Font of the text Returns: tuple (left, right, top, bottom) representing margins
-
draw
(painter, rect, flags, text)[source] Draw the text in a clipping rectangle
Parameters: - painter (QPainter) – Painter
- rect (QRectF) – Clipping rectangle
- flags (int) – Bitwise OR of the flags like in for QPainter::drawText()
- text (str) – Text to be rendered
-
mightRender
(text)[source] Test if a string can be rendered by this text engine
Parameters: text (str) – Text to be tested Returns: True, if it can be rendered
-
-
class
qwt.text_engine.
QwtRichTextEngine
[source] A text engine for Qt rich texts
QwtRichTextEngine renders Qt rich texts using the classes of the Scribe framework of Qt.
-
heightForWidth
(font, flags, text, width)[source] Find the height for a given width
Parameters: - font (QFont) – Font of the text
- flags (int) – Bitwise OR of the flags used like in QPainter::drawText
- text (str) – Text to be rendered
- width (float) – Width
Returns: Calculated height
-
textSize
(font, flags, text)[source] Returns the size, that is needed to render text
Parameters: - font (QFont) – Font of the text
- flags (int) – Bitwise OR of the flags like in for QPainter::drawText
- text (str) – Text to be rendered
Returns: Calculated size
-
draw
(painter, rect, flags, text)[source] Draw the text in a clipping rectangle
Parameters: - painter (QPainter) – Painter
- rect (QRectF) – Clipping rectangle
- flags (int) – Bitwise OR of the flags like in for QPainter::drawText()
- text (str) – Text to be rendered
-
mightRender
(text)[source] Test if a string can be rendered by this text engine
Parameters: text (str) – Text to be tested Returns: True, if it can be rendered
-
textMargins
(font)[source] Return margins around the texts
The textSize might include margins around the text, like QFontMetrics::descent(). In situations where texts need to be aligned in detail, knowing these margins might improve the layout calculations.
Parameters: font (QFont) – Font of the text Returns: tuple (left, right, top, bottom) representing margins
-