• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

Enumerations | Functions
KFontUtils Namespace Reference

Enumerations

enum  AdaptFontSizeOption { NoFlags = 0x01, DoNotAllowWordWrap = 0x02 }
 

Functions

qreal adaptFontSize (QPainter &painter, const QString &text, qreal width, qreal height, qreal maxFontSize=28.0, qreal minFontSize=1.0, AdaptFontSizeOptions flags=NoFlags)
 
qreal adaptFontSize (QPainter &painter, const QString &text, const QSizeF &availableSize, qreal maxFontSize=28.0, qreal minFontSize=1.0, AdaptFontSizeOptions flags=NoFlags)
 

Enumeration Type Documentation

enum KFontUtils::AdaptFontSizeOption

Modifiers for the adaptFontSize function.

Enumerator
NoFlags 
DoNotAllowWordWrap 

Definition at line 35 of file kfontutils.h.

Function Documentation

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.

Parameters
painterThe 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
textThe text you want to draw
widthThe available width for drawing
heightThe available height for drawing
maxFontSizeThe maximum font size (in points) to consider
minFontSizeThe minimum font size (in points) to consider
flagsThe modifiers for how the text is painted
Returns
The calculated biggest font size (in points) that draws the text in the given dimensions. Can return smaller than minFontSize, that means the text doesn't fit in the given rectangle. Can return -1 on error
Since
KDE 4.7

Definition at line 27 of file kfontutils.cpp.

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.

Since
KDE 4.7

Definition at line 54 of file kfontutils.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:04 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal