org.kde.koala
public class KWordWrap extends Object implements QtSupport
UNKNOWN: Word-wrap algorithm that takes into account beautifulness ;)
Field Summary | |
---|---|
static int | FadeOut
Use this flag in drawText() if you want to fade out the text if it does
not fit into the constraining rectangle. |
static int | Truncate |
Constructor Summary | |
---|---|
protected | KWordWrap(Class dummy) |
Method Summary | |
---|---|
QRect | boundingRect() |
static void | drawFadeoutText(QPainter p, int x, int y, int maxW, String t)
Draws the string t at the given coordinates, if it does not
fit into maxW the text will be faded out. |
void | drawText(QPainter painter, int x, int y, int flags)
Draw the text that has been previously wrapped, at position x,y.
|
void | drawText(QPainter painter, int x, int y) |
static void | drawTruncateText(QPainter p, int x, int y, int maxW, String t)
Draws the string t at the given coordinates, if it does not
fit into maxW the text will be truncated. |
static KWordWrap | formatText(QFontMetrics fm, QRect r, int flags, String str, int len)
Main method for wrapping text. |
static KWordWrap | formatText(QFontMetrics fm, QRect r, int flags, String str) |
String | truncatedString(boolean dots) |
String | truncatedString() |
String | wrappedString() |
UNKNOWN: Use this flag in drawText() if you want to fade out the text if it does not fit into the constraining rectangle.
Returns: the bounding rect, calculated by formatText. The width is the width of the widest text line, and never wider than the rectangle given to formatText. The height is the text block. X and Y are always 0.
UNKNOWN:
t
at the given coordinates, if it does not
fit
into maxW
the text will be faded out.Parameters: p the painter to use. Must have set the pen for the text color and the background for the color to fade out x the horizontal position of the text y the vertical position of the text maxW the maximum width of the text (including the fade-out effect) t the text to draw
UNKNOWN: Draws the string t
at the given coordinates, if it does not fit
into maxW
the text will be faded out.
Parameters: painter the QPainter to use. x the horizontal position of the text y the vertical position of the text flags the ORed text alignment flags from the Qt namespace,
ORed with FadeOut if you want the text to fade out if it
does not fit (the painter
's background must be set
accordingly)
UNKNOWN: Draw the text that has been previously wrapped, at position x,y.
t
at the given coordinates, if it does not
fit
into maxW
the text will be truncated.Parameters: p the painter to use x the horizontal position of the text y the vertical position of the text maxW the maximum width of the text (including the '...') t the text to draw
UNKNOWN: Draws the string t
at the given coordinates, if it does not fit
into maxW
the text will be truncated.
Parameters: fm Font metrics, for the chosen font. Better cache it, creating a QFontMetrics is expensive. r Constraining rectangle. Only the width and height matter. With negative height the complete text will be rendered flags currently unused str The text to be wrapped. len Length of text to wrap (default is -1 for all).
Returns: a KWordWrap instance. The caller is responsible for storing and deleting the result.
UNKNOWN: Main method for wrapping text.
Returns: the original string, truncated to the first line.
If dots
was set, '...' is appended in case the string was truncated.
Bug: Note that the '...' come out of the bounding rect.
UNKNOWN:
Returns: the original string, with '\n' inserted where the text is broken by the wordwrap algorithm.
UNKNOWN: