KGuiAddons 5.109.0
|
Provides utility functions for font data. More...
Typedefs | |
typedef QFlags< AdaptFontSizeOption > | AdaptFontSizeOptions |
Stores a combination of #AdaptFontSizeOption values. | |
Enumerations | |
enum | AdaptFontSizeOption { NoFlags = 0x01 , DoNotAllowWordWrap = 0x02 } |
Modifiers for the adaptFontSize function. More... | |
Functions | |
qreal | adaptFontSize (QPainter &painter, const QString &text, const QSizeF &availableSize, qreal maxFontSize=28.0, qreal minFontSize=1.0, AdaptFontSizeOptions flags=NoFlags) |
Convenience function for adaptFontSize that accepts a QSizeF instead two qreals. | |
qreal | adaptFontSize (QPainter &painter, const QString &text, qreal width, qreal height, qreal maxFontSize=28.0, qreal minFontSize=1.0, AdaptFontSizeOptions flags=NoFlags) |
Helper function that calculates the biggest font size (in points) used drawing a centered text using word wrapping. | |
Provides utility functions for font data.
typedef QFlags< AdaptFontSizeOption > KFontUtils::AdaptFontSizeOptions |
Stores a combination of #AdaptFontSizeOption values.
qreal KFontUtils::adaptFontSize | ( | QPainter & | painter, |
const QString & | text, | ||
const QSizeF & | availableSize, | ||
qreal | maxFontSize = 28.0 , |
||
qreal | minFontSize = 1.0 , |
||
AdaptFontSizeOptions | flags = NoFlags |
||
) |
Convenience function for adaptFontSize that accepts a QSizeF instead two qreals.
qreal KFontUtils::adaptFontSize | ( | QPainter & | painter, |
const QString & | text, | ||
qreal | width, | ||
qreal | height, | ||
qreal | maxFontSize = 28.0 , |
||
qreal | minFontSize = 1.0 , |
||
AdaptFontSizeOptions | flags = NoFlags |
||
) |
Helper function that calculates the biggest font size (in points) used drawing a centered text using word wrapping.
painter | The painter where the text will be painted. The font set in the painter is used for the calculation. Note the painter font size is modified by this call |
text | The text you want to draw |
width | The available width for drawing |
height | The available height for drawing |
maxFontSize | The maximum font size (in points) to consider |
minFontSize | The minimum font size (in points) to consider |
flags | The modifiers for how the text is painted |