Qt Jambi Home

com.trolltech.qt.gui
Class QTextBlockFormat

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.gui.QTextFormat
              extended by com.trolltech.qt.gui.QTextBlockFormat
All Implemented Interfaces:
QtJambiInterface

public class QTextBlockFormat
extends QTextFormat

The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument.

A document is composed of a list of blocks, represented by QTextBlock objects. Each block can contain an item of some kind, such as a paragraph of text, a table, a list, or an image. Every block has an associated QTextBlockFormat that specifies its characteristics.

To cater for left-to-right and right-to-left languages you can set a block's direction with setDirection(). Paragraph alignment is set with setAlignment. Margins are controlled by setTopMargin, setBottomMargin, setLeftMargin, setRightMargin. Overall indentation is set with setIndent, the indentation of the first line with setTextIndent.

Line breaking can be enabled and disabled with setNonBreakableLines.

The brush used to paint the paragraph's background is set with setBackground(), and other aspects of the text's appearance can be customized by using the setProperty() function with the OutlinePen, ForegroundBrush, and BackgroundBrush QTextFormat::Property values.

If a text block is part of a list, it can also have a list format that is accessible with the listFormat() function.

See Also:
QTextBlock, QTextCharFormat

Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QTextFormat
QTextFormat.FormatType, QTextFormat.ObjectTypes, QTextFormat.PageBreakFlag, QTextFormat.PageBreakFlags, QTextFormat.Property
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QTextBlockFormat()
          Constructs a new QTextBlockFormat.
 
Method Summary
 Qt.Alignment alignment()
          Returns the paragraph's alignment.
 double bottomMargin()
          Returns the paragraph's bottom margin.
static QTextBlockFormat fromNativePointer(QNativePointer nativePointer)
          This function returns the QTextBlockFormat instance pointed to by nativePointer
 int indent()
          Returns the paragraph's indent.
 boolean isValid()
          Returns true if this block format is valid; otherwise returns false.
 double leftMargin()
          Returns the paragraph's left margin.
static QNativePointer nativePointerArray(QTextBlockFormat[] array)
          This function returns a QNativePointer that is pointing to the specified QTextBlockFormat array.
 boolean nonBreakableLines()
          Returns true if the lines in the paragraph are non-breakable; otherwise returns false.
 QTextFormat.PageBreakFlags pageBreakPolicy()
          Returns the currently set page break policy for the paragraph.
 double rightMargin()
          Returns the paragraph's right margin.
 void setAlignment(Qt.Alignment alignment)
          Sets the paragraph's alignment.
 void setAlignment(Qt.AlignmentFlag... alignment)
          Sets the paragraph's alignment.
 void setBottomMargin(double margin)
          Sets the paragraph's bottom margin.
 void setIndent(int indent)
          Sets the paragraph's indent.
 void setLeftMargin(double margin)
          Sets the paragraph's left margin.
 void setNonBreakableLines(boolean b)
          If b is true, the lines in the paragraph are treated as non-breakable; otherwise they are breakable.
 void setPageBreakPolicy(QTextFormat.PageBreakFlag... flags)
          Sets the page break policy for the paragraph to flags.
 void setPageBreakPolicy(QTextFormat.PageBreakFlags flags)
          Sets the page break policy for the paragraph to flags.
 void setRightMargin(double margin)
          Sets the paragraph's right margin.
 void setTextIndent(double margin)
          Sets the margin for the first line in the block.
 void setTopMargin(double margin)
          Sets the paragraph's top margin.
 double textIndent()
          Returns the paragraph's text indent.
 double topMargin()
          Returns the paragraph's top margin.
 
Methods inherited from class com.trolltech.qt.gui.QTextFormat
background, boolProperty, brushProperty, clearBackground, clearForeground, clearProperty, colorProperty, doubleProperty, equals, foreground, hasProperty, intProperty, isBlockFormat, isCharFormat, isFrameFormat, isImageFormat, isListFormat, isTableFormat, layoutDirection, lengthProperty, lengthVectorProperty, merge, nativePointerArray, objectIndex, objectType, penProperty, properties, property, propertyCount, readFrom, setBackground, setForeground, setLayoutDirection, setObjectIndex, setObjectType, setProperty, setProperty, stringProperty, toBlockFormat, toCharFormat, toFrameFormat, toImageFormat, toListFormat, toTableFormat, type, writeTo
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QTextBlockFormat

public QTextBlockFormat()

Constructs a new QTextBlockFormat.

Method Detail

alignment

public final Qt.Alignment alignment()

Returns the paragraph's alignment.

See Also:
setAlignment

bottomMargin

public final double bottomMargin()

Returns the paragraph's bottom margin.

See Also:
setBottomMargin, topMargin

indent

public final int indent()

Returns the paragraph's indent.

See Also:
setIndent

isValid

public final boolean isValid()

Returns true if this block format is valid; otherwise returns false.

Overrides:
isValid in class QTextFormat

leftMargin

public final double leftMargin()

Returns the paragraph's left margin.

See Also:
setLeftMargin, rightMargin, indent

nonBreakableLines

public final boolean nonBreakableLines()

Returns true if the lines in the paragraph are non-breakable; otherwise returns false.

See Also:
setNonBreakableLines

pageBreakPolicy

public final QTextFormat.PageBreakFlags pageBreakPolicy()

Returns the currently set page break policy for the paragraph. The default is QTextFormat::PageBreak_Auto.

See Also:
setPageBreakPolicy

rightMargin

public final double rightMargin()

Returns the paragraph's right margin.

See Also:
setRightMargin, leftMargin

setAlignment

public final void setAlignment(Qt.AlignmentFlag... alignment)

Sets the paragraph's alignment.

See Also:
alignment

setAlignment

public final void setAlignment(Qt.Alignment alignment)

Sets the paragraph's alignment.

See Also:
alignment

setBottomMargin

public final void setBottomMargin(double margin)

Sets the paragraph's bottom margin.

See Also:
bottomMargin, setTopMargin, setLeftMargin, setRightMargin

setIndent

public final void setIndent(int indent)

Sets the paragraph's indent. Margins are set independently of indentation with setLeftMargin and setTextIdent().

See Also:
indent

setLeftMargin

public final void setLeftMargin(double margin)

Sets the paragraph's left margin. Indentation can be applied separately with setIndent.

See Also:
leftMargin, setRightMargin, setTopMargin, setBottomMargin

setNonBreakableLines

public final void setNonBreakableLines(boolean b)

If b is true, the lines in the paragraph are treated as non-breakable; otherwise they are breakable.

See Also:
nonBreakableLines

setPageBreakPolicy

public final void setPageBreakPolicy(QTextFormat.PageBreakFlag... flags)

Sets the page break policy for the paragraph to flags.

See Also:
pageBreakPolicy

setPageBreakPolicy

public final void setPageBreakPolicy(QTextFormat.PageBreakFlags flags)

Sets the page break policy for the paragraph to flags.

See Also:
pageBreakPolicy

setRightMargin

public final void setRightMargin(double margin)

Sets the paragraph's right margin.

See Also:
rightMargin, setLeftMargin, setTopMargin, setBottomMargin

setTextIndent

public final void setTextIndent(double margin)

Sets the margin for the first line in the block. This allows the first line of a paragraph to be indented differently to the other lines, enhancing the readability of the text.

See Also:
textIndent, setLeftMargin, setRightMargin, setTopMargin, setBottomMargin

setTopMargin

public final void setTopMargin(double margin)

Sets the paragraph's top margin.

See Also:
topMargin, setBottomMargin, setLeftMargin, setRightMargin

textIndent

public final double textIndent()

Returns the paragraph's text indent.

See Also:
setTextIndent

topMargin

public final double topMargin()

Returns the paragraph's top margin.

See Also:
setTopMargin, bottomMargin

fromNativePointer

public static QTextBlockFormat fromNativePointer(QNativePointer nativePointer)
This function returns the QTextBlockFormat instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

public static QNativePointer nativePointerArray(QTextBlockFormat[] array)
This function returns a QNativePointer that is pointing to the specified QTextBlockFormat array.

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

Qt Jambi Home