Auf dieser Seite

QTextFormat Class

Die Klasse „QTextFormat“ stellt Formatierungsinformationen für ein „ QTextDocument “ bereit. Mehr...

Header: #include <QTextFormat>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Vererbt an:

QTextBlockFormat, QTextCharFormat, QTextFrameFormat sowie QTextListFormat

Hinweis: Alle Funktionen dieser Klasse sind reentrant.

Öffentliche Typen

enum FormatType { InvalidFormat, BlockFormat, CharFormat, ListFormat, FrameFormat, UserFormat }
enum ObjectTypes { NoObject, ImageObject, TableObject, TableCellObject, UserObject }
enum PageBreakFlag { PageBreak_Auto, PageBreak_AlwaysBefore, PageBreak_AlwaysAfter }
flags PageBreakFlags
enum Property { ObjectIndex, CssFloat, LayoutDirection, OutlinePen, ForegroundBrush, …, UserProperty }

Öffentliche Funktionen

QTextFormat()
QTextFormat(int type)
QTextFormat(const QTextFormat &other)
~QTextFormat()
QBrush background() const
bool boolProperty(int propertyId) const
QBrush brushProperty(int propertyId) const
void clearBackground()
void clearForeground()
void clearProperty(int propertyId)
QColor colorProperty(int propertyId) const
qreal doubleProperty(int propertyId) const
QBrush foreground() const
bool hasProperty(int propertyId) const
int intProperty(int propertyId) const
bool isBlockFormat() const
bool isCharFormat() const
bool isEmpty() const
bool isFrameFormat() const
bool isImageFormat() const
bool isListFormat() const
bool isTableCellFormat() const
bool isTableFormat() const
bool isValid() const
Qt::LayoutDirection layoutDirection() const
QTextLength lengthProperty(int propertyId) const
QList<QTextLength> lengthVectorProperty(int propertyId) const
void merge(const QTextFormat &other)
int objectIndex() const
int objectType() const
QPen penProperty(int propertyId) const
QMap<int, QVariant> properties() const
QVariant property(int propertyId) const
int propertyCount() const
void setBackground(const QBrush &brush)
void setForeground(const QBrush &brush)
void setLayoutDirection(Qt::LayoutDirection direction)
void setObjectIndex(int index)
void setObjectType(int type)
void setProperty(int propertyId, const QList<QTextLength> &value)
void setProperty(int propertyId, const QVariant &value)
QString stringProperty(int propertyId) const
void swap(QTextFormat &other)
QTextBlockFormat toBlockFormat() const
QTextCharFormat toCharFormat() const
QTextFrameFormat toFrameFormat() const
QTextImageFormat toImageFormat() const
QTextListFormat toListFormat() const
QTextTableCellFormat toTableCellFormat() const
QTextTableFormat toTableFormat() const
int type() const
operator QVariant() const
bool operator!=(const QTextFormat &other) const
QTextFormat &operator=(const QTextFormat &other)
bool operator==(const QTextFormat &other) const

Ausführliche Beschreibung

Ein QTextFormat ist eine generische Klasse, die zur Beschreibung des Formats von Teilen eines „ QTextDocument “ verwendet wird. Die abgeleiteten Klassen „ QTextCharFormat “, „ QTextBlockFormat “, „ QTextListFormat “ und „ QTextTableFormat “ sind in der Regel nützlicher und beschreiben die Formatierung, die auf bestimmte Teile des Dokuments angewendet wird.

Ein Format verfügt über eine „ FormatType “, die angibt, welche Arten von Textelementen es formatieren kann, z. B. einen Textblock, eine Liste, eine Tabelle usw. Ein Format verfügt außerdem über verschiedene Eigenschaften (von denen einige spezifisch für bestimmte Formattypen sind), wie durch die Enumeration „Property“ beschrieben. Jede Eigenschaft hat eine entsprechende „Property“.

Der Format-Typ wird durch ` type()` angegeben, und das Format kann mit ` isCharFormat()`, ` isBlockFormat()`, ` isListFormat()`, ` isTableFormat()`, ` isFrameFormat()` und ` isImageFormat()` geprüft werden. Ist der Typ ermittelt, kann er mit ` toCharFormat()`, ` toBlockFormat()`, ` toListFormat()`, ` toTableFormat()`, ` toFrameFormat()` und ` toImageFormat()` abgerufen werden.

Die Eigenschaften eines Formats können mit den Funktionen „ setProperty()“ festgelegt und je nach Bedarf mit „ boolProperty()“, „ intProperty()“, „ doubleProperty()“ und „ stringProperty()“ abgerufen werden. Alle im Format verwendeten Eigenschafts-IDs können mit „allPropertyIds()“ abgerufen werden. Ein Format kann mithilfe von „ merge()“ in ein anderes zusammengeführt werden.

Der Objektindex eines Formats kann mit ` setObjectIndex()` gesetzt und mit ` objectIndex()` abgerufen werden. Diese Methoden können verwendet werden, um das Format einem ` QTextObject` zuzuordnen. Es wird verwendet, um Listen, Rahmen und Tabellen innerhalb des Dokuments darzustellen.

Siehe auch „Rich-Text-Verarbeitung“.

Dokumentation zu Mitgliedstypen

enum QTextFormat::FormatType

Diese Enumeration beschreibt das Textelement, das ein „ QTextFormat “-Objekt formatiert.

KonstanteWertBeschreibung
QTextFormat::InvalidFormat-1Ein ungültiges Format, wie es vom Standardkonstruktor erstellt wurde
QTextFormat::BlockFormat1Das Objekt formatiert einen Textblock
QTextFormat::CharFormat2Das Objekt formatiert ein einzelnes Zeichen
QTextFormat::ListFormat3Das Objekt formatiert eine Liste
QTextFormat::FrameFormat5Das Objekt formatiert einen Rahmen
QTextFormat::UserFormat100 

Siehe auch QTextCharFormat, QTextBlockFormat, QTextListFormat, QTextTableFormat und type().

enum QTextFormat::ObjectTypes

Diese Enumeration beschreibt, mit welcher Art von „ QTextObject “ dieses Format verknüpft ist.

KonstanteWertBeschreibung
QTextFormat::NoObject0 
QTextFormat::ImageObject1 
QTextFormat::TableObject2 
QTextFormat::TableCellObject3 
QTextFormat::UserObject0x1000Das erste Objekt, das für anwendungsspezifische Zwecke verwendet werden kann.

Siehe auch „ QTextObject“ , „ QTextTable “ und „ QTextObject::format()“.

enum QTextFormat::PageBreakFlag
flags QTextFormat::PageBreakFlags

Diese Enumeration beschreibt, wie der Seitenumbruch beim Drucken erfolgt. Sie entspricht den entsprechenden CSS-Eigenschaften.

KonstanteWertBeschreibung
QTextFormat::PageBreak_Auto0Der Seitenumbruch wird automatisch in Abhängigkeit vom verfügbaren Platz auf der aktuellen Seite festgelegt
QTextFormat::PageBreak_AlwaysBefore0x001Der Seitenumbruch erfolgt immer vor dem Absatz/der Tabelle
QTextFormat::PageBreak_AlwaysAfter0x010Nach dem Absatz/der Tabelle wird immer eine neue Seite begonnen

Der Typ „PageBreakFlags“ ist ein `typedef` für ` QFlags<PageBreakFlag>`. Er speichert eine ODER-Kombination von `PageBreakFlag`-Werten.

Siehe auch QTextBlockFormat::pageBreakPolicy(), QTextFrameFormat::pageBreakPolicy() und PageBreakPolicy.

enum QTextFormat::Property

Diese Enumeration beschreibt die verschiedenen Eigenschaften, die ein Format aufweisen kann.

KonstanteWertBeschreibung
QTextFormat::ObjectIndex0x0Der Index des formatierten Objekts. Siehe objectIndex().

Absatz- und Zeicheneigenschaften

KonstanteWertBeschreibung
QTextFormat::CssFloat0x0800Wie ein Rahmen relativ zum umgebenden Text positioniert ist
QTextFormat::LayoutDirection0x0801Die Ausrichtungsrichtung des Textes im Dokument (Qt::LayoutDirection).
QTextFormat::OutlinePen0x810 
QTextFormat::ForegroundBrush0x821 
QTextFormat::BackgroundBrush0x820 
QTextFormat::BackgroundImageUrl0x823 

Absatzeigenschaften

KonstanteWertBeschreibung
QTextFormat::BlockAlignment0x1010 
QTextFormat::BlockTopMargin0x1030 
QTextFormat::BlockBottomMargin0x1031 
QTextFormat::BlockLeftMargin0x1032 
QTextFormat::BlockRightMargin0x1033 
QTextFormat::TextIndent0x1034 
QTextFormat::TabPositions0x1035Legt die Tabulatorpositionen fest. Die Tabulatorpositionen sind Strukturen vom Typ „ QTextOption::Tab “, die in einer „ QList “ gespeichert sind (intern in einer „ QList “ <QVariant>).
QTextFormat::BlockIndent0x1040 
QTextFormat::LineHeight0x1048 
QTextFormat::LineHeightType0x1049 
QTextFormat::BlockNonBreakableLines0x1050 
QTextFormat::BlockTrailingHorizontalRulerWidth0x1060Die Breite eines horizontalen Linealelements.
QTextFormat::HeadingLevel0x1070Die Ebene einer Überschrift; beispielsweise entspricht 1 einem HTML-H1-Tag, andernfalls 0. Dieser Enum-Wert wurde in Qt 5.12 hinzugefügt.
QTextFormat::BlockCodeFence0x1091Das Zeichen, das für die „Einhüllung“ eines Markdown-Codeblocks verwendet wurde. Wenn der Codeblock eingerückt statt eingefasst wurde, sollte der Block diese Eigenschaft nicht aufweisen. Dieser Enum-Wert wurde in Qt 5.14 hinzugefügt.
QTextFormat::BlockQuoteLevel0x1080Die Tiefe der verschachtelten Zitate in diesem Block: 1 bedeutet, dass es sich bei dem Block um ein Blockzitat der obersten Ebene handelt. Blöcke, die keine Blockzitate sind, sollten diese Eigenschaft nicht aufweisen. Dieser Enum-Wert wurde in Qt 5.14 hinzugefügt.
QTextFormat::BlockCodeLanguage0x1090Die Programmiersprache in einem vorformatierten oder Code-Block. Blöcke, die keinen Code enthalten, sollten diese Eigenschaft nicht haben. Dieser Enum-Wert wurde in Qt 5.14 hinzugefügt.
QTextFormat::BlockMarker0x10A0Die „ type of adornment “, die neben dem Block angezeigt werden soll. Dieser Enum-Wert wurde in Qt 5.14 hinzugefügt.

Zeicheneigenschaften

KonstanteWertBeschreibung
QTextFormat::FontFamily0x2000e{Diese Eigenschaft ist veraltet.} Verwenden Sie stattdessen QTextFormat::FontFamilies.
QTextFormat::FontFamilies0x1FE7 
QTextFormat::FontStyleName0x1FE8 
QTextFormat::FontPointSize0x2001 
QTextFormat::FontPixelSize0x2009 
QTextFormat::FontSizeAdjustment0x2002Gibt einen ganzzahligen Anpassungswert an, der zur mit ` FontPointSize ` oder ` FontPixelSize` festgelegten Basis-Schriftgröße addiert wird.
QTextFormat::FontFixedPitch0x2008 
QTextFormat::FontWeight0x2003 
QTextFormat::FontItalic0x2004 
QTextFormat::FontUnderline0x2005Diese Eigenschaft ist veraltet. Verwenden Sie stattdessen QTextFormat::TextUnderlineStyle.
QTextFormat::FontOverline0x2006 
QTextFormat::FontStrikeOut0x2007 
QTextFormat::FontCapitalizationFirstFontPropertyLegt die Art der Großschreibung fest, die auf den Text angewendet werden soll.
QTextFormat::FontLetterSpacingType0x1FE9Legt die Bedeutung der Eigenschaft „FontLetterSpacing“ fest. Der Standardwert ist „ QFont::PercentageSpacing “.
QTextFormat::FontLetterSpacing0x1FE1Ändert den Standardabstand zwischen einzelnen Buchstaben in der Schriftart. Der Wert wird je nach FontLetterSpacingType als Prozentsatz oder als absoluter Wert angegeben. Der Standardwert beträgt 100 %.
QTextFormat::FontWordSpacing0x1FE2Ändert den Standardabstand zwischen einzelnen Wörtern. Ein positiver Wert vergrößert den Wortabstand um die entsprechende Pixelanzahl; ein negativer Wert verringert den Abstand.
QTextFormat::FontStretch0x1FEAEntspricht der Eigenschaft „ QFont::Stretch “
QTextFormat::FontStyleHint0x1FE3Entspricht der Eigenschaft „ QFont::StyleHint “
QTextFormat::FontStyleStrategy0x1FE4Entspricht der Eigenschaft „ QFont::StyleStrategy “
QTextFormat::FontKerning0x1FE5Gibt an, ob für die Schriftart Kerning aktiviert ist.
QTextFormat::FontHintingPreference0x1FE6Steuert die Verwendung von Hinting entsprechend den Werten der Aufzählung „ QFont::HintingPreference “.
QTextFormat::FontFeatures0x2010[seit 6.11] Weist typografischen Merkmalen Ganzzahlwerte zu. Weitere Informationen finden Sie unter „ QFont::setFeature()“.
QTextFormat::FontVariableAxes0x2011[seit 6.11] Weist variablen Achsen in variablen Schriftarten Gleitkommazahlen zu. Weitere Informationen finden Sie unter ` QFont::setVariableAxis()`.
QTextFormat::TextUnderlineColor0x2020Legt die Farbe fest, in der Unterstreichungen, Überstriche und Durchstreichungen gezeichnet werden.
QTextFormat::TextVerticalAlignment0x2021Legt die Art der vertikalen Textausrichtung entsprechend den Werten der Enumeration „ QTextCharFormat::VerticalAlignment “ fest.
QTextFormat::TextOutline0x2022Legt eine „ QPen “ fest, die zum Zeichnen des Textumrisses verwendet wird.
QTextFormat::TextUnderlineStyle0x2023Legt den Stil der Textunterstreichung entsprechend den Werten der Enumeration „ QTextCharFormat::UnderlineStyle “ fest.
QTextFormat::TextToolTip0x2024Legt den (optionalen) Tooltip fest, der für ein Textfragment angezeigt werden soll.
QTextFormat::TextSuperScriptBaseline0x2025Legt die Grundlinie (in % der Höhe) von hochgestellten Texten fest.
QTextFormat::TextSubScriptBaseline0x2026Legt die Grundlinie (in % der Höhe) von hochgestellten Texten fest.
QTextFormat::TextBaselineOffset0x2027Legt die Grundlinie (in % der Höhe) des Textes fest. Ein positiver Wert verschiebt den Text um den entsprechenden Prozentsatz nach oben; ein negativer Wert verschiebt ihn nach unten.
QTextFormat::IsAnchor0x2030 
QTextFormat::AnchorHref0x2031 
QTextFormat::AnchorName0x2032 
QTextFormat::ObjectType0x2f00 

Liste der Eigenschaften

KonstanteWertBeschreibung
QTextFormat::ListStyle0x3000Gibt den Stil an, der für die Elemente einer Liste verwendet wird, beschrieben durch die Werte der Enumeration „ QTextListFormat::Style “.
QTextFormat::ListIndent0x3001Legt die Einrückung für eine Liste fest.
QTextFormat::ListNumberPrefix0x3002Definiert den Text, der den Elementnummern in numerischen Listen vorangestellt wird.
QTextFormat::ListNumberSuffix0x3003Definiert den Text, der an die Elementnummern in numerischen Listen angehängt wird.
QTextFormat::ListStart (since Qt 6.6)0x3004Definiert den ersten Wert einer Liste.

Tabellen- und Rahmeneigenschaften

KonstanteWertBeschreibung
QTextFormat::FrameBorder0x4000 
QTextFormat::FrameBorderBrush0x4009 
QTextFormat::FrameBorderStyle0x4010Siehe die Enumeration „ BorderStyle “.
QTextFormat::FrameBottomMargin0x4006 
QTextFormat::FrameHeight0x4004 
QTextFormat::FrameLeftMargin0x4007 
QTextFormat::FrameMargin0x4001 
QTextFormat::FramePadding0x4002 
QTextFormat::FrameRightMargin0x4008 
QTextFormat::FrameTopMargin0x4005 
QTextFormat::FrameWidth0x4003 
QTextFormat::TableCellSpacing0x4102 
QTextFormat::TableCellPadding0x4103 
QTextFormat::TableColumns0x4100 
QTextFormat::TableColumnWidthConstraints0x4101 
QTextFormat::TableHeaderRowCount0x4104 
QTextFormat::TableBorderCollapse0x4105Legt die Eigenschaft „ QTextTableFormat::borderCollapse “ fest.

Eigenschaften von Tabellenzellen

KonstanteWert
QTextFormat::TableCellRowSpan0x4810
QTextFormat::TableCellColumnSpan0x4811
QTextFormat::TableCellLeftPadding0x4814
QTextFormat::TableCellRightPadding0x4815
QTextFormat::TableCellTopPadding0x4812
QTextFormat::TableCellBottomPadding0x4813

Tabellenzelleneigenschaften, die für die Verwendung bei aktiviertem „ QTextTableFormat::borderCollapse “ vorgesehen sind

KonstanteWert
QTextFormat::TableCellTopBorder0x4816
QTextFormat::TableCellBottomBorder0x4817
QTextFormat::TableCellLeftBorder0x4818
QTextFormat::TableCellRightBorder0x4819
QTextFormat::TableCellTopBorderStyle0x481a
QTextFormat::TableCellBottomBorderStyle0x481b
QTextFormat::TableCellLeftBorderStyle0x481c
QTextFormat::TableCellRightBorderStyle0x481d
QTextFormat::TableCellTopBorderBrush0x481e
QTextFormat::TableCellBottomBorderBrush0x481f
QTextFormat::TableCellLeftBorderBrush0x4820
QTextFormat::TableCellRightBorderBrush0x4821

Bildeigenschaften

KonstanteWertBeschreibung
QTextFormat::ImageName0x5000Der Dateiname oder die Quelle des Bildes.
QTextFormat::ImageTitle0x5001Das „title“-Attribut eines HTML-Bild-Tags oder die in Anführungszeichen gesetzte Zeichenfolge, die in einem Markdown-Bildlink auf die URL folgt. Dieser Enum-Wert wurde in Qt 5.14 hinzugefügt.
QTextFormat::ImageAltText0x5002Das „alt“-Attribut eines HTML-Bild-Tags oder die Bildbeschreibung in einem Markdown-Bildlink. Dieser Enum-Wert wurde in Qt 5.14 hinzugefügt.
QTextFormat::ImageWidth0x5010 
QTextFormat::ImageHeight0x5011 
QTextFormat::ImageQuality0x5014 
QTextFormat::ImageMaxWidth0x5015Dieser Enum-Wert wurde in Qt 6.8 hinzugefügt.

Auswahleigenschaften

KonstanteWertBeschreibung
QTextFormat::FullWidthSelection0x06000Wird dieser Wert für das `characterFormat` einer Auswahl festgelegt, wird die gesamte Breite des Textes als ausgewählt angezeigt.

Seitenumbruch-Eigenschaften

KonstanteWertBeschreibung
QTextFormat::PageBreakPolicy0x7000Legt fest, wie Seiten umgebrochen werden. Siehe die Enumeration „ PageBreakFlag “.
QTextFormat::UserProperty0x100000 

Siehe auch „ property()“ und „ setProperty()“.

Dokumentation zu den Member-Funktionen

QTextFormat::QTextFormat()

Erstellt ein neues Textformat mit einem „ InvalidFormat “.

Siehe auch „ FormatType “.

[explicit] QTextFormat::QTextFormat(int type)

Erstellt ein neues Textformat der angegebenen Datei „ type “.

Siehe auch „ FormatType “.

QTextFormat::QTextFormat(const QTextFormat &other)

Erstellt ein neues Textformat mit denselben Attributen wie das Textformat „ other “.

[noexcept] QTextFormat::~QTextFormat()

Löscht dieses Textformat.

QBrush QTextFormat::background() const

Gibt den Pinsel zurück, der zum Ausmalen des Dokumenthintergrunds verwendet wurde.

Siehe auch setBackground(), clearBackground() und foreground().

bool QTextFormat::boolProperty(int propertyId) const

Gibt den Wert der durch ` propertyId` angegebenen Eigenschaft zurück. Ist die Eigenschaft nicht vom Typ `QTextFormat::Bool`, wird stattdessen `false` zurückgegeben.

Siehe auch „ setProperty()“, „ intProperty()“, „ doubleProperty()“, „ stringProperty()“, „ colorProperty()“, „ lengthProperty()“, „ lengthVectorProperty()“ und „ Property “.

QBrush QTextFormat::brushProperty(int propertyId) const

Gibt den Wert der durch propertyId angegebenen Eigenschaft zurück; wenn die Eigenschaft nicht vom Typ QMetaType::QBrush ist, wird stattdessen Qt::NoBrush zurückgegeben.

Siehe auch „ setProperty()“, „ boolProperty()“, „ intProperty()“, „ doubleProperty()“, „ stringProperty()“, „ lengthProperty()“, „ lengthVectorProperty()“ und „ Property “.

void QTextFormat::clearBackground()

Löscht den Pinsel, der zum Ausmalen des Dokumenthintergrunds verwendet wurde. Es wird der Standardpinsel verwendet.

Siehe auch background(), setBackground() und clearForeground().

void QTextFormat::clearForeground()

Löscht den Pinsel, der zum Malen des Vordergrunds des Dokuments verwendet wurde. Es wird der Standardpinsel verwendet.

Siehe auch foreground(), setForeground() und clearBackground().

void QTextFormat::clearProperty(int propertyId)

Löscht den Wert der durch propertyId

Siehe auch Property.

QColor QTextFormat::colorProperty(int propertyId) const

Gibt den Wert der durch ` propertyId` angegebenen Eigenschaft zurück; wenn die Eigenschaft nicht vom Typ ` QMetaType::QColor ` ist, wird stattdessen eine ungültige Farbe zurückgegeben.

Siehe auch setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), lengthProperty(), lengthVectorProperty() und Property.

qreal QTextFormat::doubleProperty(int propertyId) const

Gibt den Wert der durch „ propertyId “ angegebenen Eigenschaft zurück. Ist die Eigenschaft nicht vom Typ „ QMetaType::Double “ oder „ QMetaType::Float “, wird stattdessen 0 zurückgegeben.

Siehe auch setProperty(), boolProperty(), intProperty(), stringProperty(), colorProperty(), lengthProperty(), lengthVectorProperty() und Property.

QBrush QTextFormat::foreground() const

Gibt den Pinsel zurück, der zum Rendern von Vordergrunddetails wie Text, Rahmenkonturen und Tabellenrändern verwendet wird.

Siehe auch setForeground(), clearForeground() und background().

bool QTextFormat::hasProperty(int propertyId) const

Gibt „ true “ zurück, wenn das Textformat eine Eigenschaft mit dem angegebenen Wert „ propertyId “ besitzt; andernfalls wird „ false “ zurückgegeben.

Siehe auch properties() und Property.

int QTextFormat::intProperty(int propertyId) const

Gibt den Wert der durch ` propertyId` angegebenen Eigenschaft zurück. Ist die Eigenschaft nicht vom Typ `QTextFormat::Integer`, wird stattdessen 0 zurückgegeben.

Siehe auch „ setProperty()“, „ boolProperty()“, „ doubleProperty()“, „ stringProperty()“, „ colorProperty()“, „ lengthProperty()“, „ lengthVectorProperty()“ und „ Property “.

bool QTextFormat::isBlockFormat() const

Gibt „ true “ zurück, wenn dieses Textformat ein „ BlockFormat “ ist; andernfalls wird „ false “ zurückgegeben.

bool QTextFormat::isCharFormat() const

Gibt „ true “ zurück, wenn dieses Textformat ein „ CharFormat “ ist; andernfalls wird „ false “ zurückgegeben.

bool QTextFormat::isEmpty() const

Gibt „true“ zurück, wenn das Format keine Eigenschaften enthält; andernfalls „false“.

Siehe auch „ propertyCount()“ und „ properties()“.

bool QTextFormat::isFrameFormat() const

Gibt „ true “ zurück, wenn dieses Textformat ein „ FrameFormat “ ist; andernfalls wird „ false “ zurückgegeben.

bool QTextFormat::isImageFormat() const

Gibt „ true “ zurück, wenn es sich bei diesem Textformat um ein Bildformat handelt; andernfalls wird „ false “ zurückgegeben.

bool QTextFormat::isListFormat() const

Gibt „ true “ zurück, wenn dieses Textformat ein „ ListFormat “ ist; andernfalls wird „ false “ zurückgegeben.

bool QTextFormat::isTableCellFormat() const

Gibt „ true “ zurück, wenn dieses Textformat ein „ TableCellFormat “ ist; andernfalls wird „ false “ zurückgegeben.

bool QTextFormat::isTableFormat() const

Gibt „ true “ zurück, wenn dieses Textformat ein „ TableFormat “ ist; andernfalls wird „ false “ zurückgegeben.

bool QTextFormat::isValid() const

Gibt „ true “ zurück, wenn das Format gültig ist (d. h. nicht „ InvalidFormat “ lautet); andernfalls wird „ false “ zurückgegeben.

Qt::LayoutDirection QTextFormat::layoutDirection() const

Gibt die Layoutrichtung des Dokuments zurück.

Siehe auch „ setLayoutDirection()“.

QTextLength QTextFormat::lengthProperty(int propertyId) const

Gibt den Wert der durch propertyId angegebenen Eigenschaft zurück.

Siehe auch setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthVectorProperty() und Property.

QList<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const

Gibt den Wert der durch ` propertyId` angegebenen Eigenschaft zurück. Ist die Eigenschaft nicht vom Typ `QTextFormat::LengthVector`, wird stattdessen eine leere Liste zurückgegeben.

Siehe auch setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthProperty() und Property.

void QTextFormat::merge(const QTextFormat &other)

Führt das Format „ other “ mit diesem Format zusammen; bei Konflikten hat das Format „ other “ Vorrang.

int QTextFormat::objectIndex() const

Gibt den Index des Formatobjekts zurück oder -1, wenn das Formatobjekt ungültig ist.

Siehe auch „ setObjectIndex()“.

int QTextFormat::objectType() const

Gibt den Objekttyp des Textformats zurück.

Siehe auch „ ObjectTypes “ und „ setObjectType()“.

QPen QTextFormat::penProperty(int propertyId) const

Gibt den Wert der durch propertyId angegebenen Eigenschaft zurück; wenn die Eigenschaft nicht vom Typ QMetaType::QPen ist, wird stattdessen Qt::NoPen zurückgegeben.

Siehe auch „ setProperty()“, „ boolProperty()“, „ intProperty()“, „ doubleProperty()“, „ stringProperty()“, „ lengthProperty()“, „ lengthVectorProperty()“ und „ Property “.

QMap<int, QVariant> QTextFormat::properties() const

Gibt ein Map mit allen Eigenschaften dieses Textformats zurück.

QVariant QTextFormat::property(int propertyId) const

Gibt die durch die angegebene propertyId angegebene Eigenschaft zurück.

Siehe auch setProperty() und Property.

int QTextFormat::propertyCount() const

Gibt die Anzahl der im Format gespeicherten Eigenschaften zurück.

void QTextFormat::setBackground(const QBrush &brush)

Legt den Pinsel fest, mit dem der Hintergrund des Dokuments gemalt wird, und zwar den unter brush angegebenen.

Siehe auch „ background()“, „ clearBackground()“ und „ setForeground()“.

void QTextFormat::setForeground(const QBrush &brush)

Setzt den Vordergrundpinsel auf den angegebenen brush. Der Vordergrundpinsel wird hauptsächlich zum Zeichnen von Text verwendet.

Siehe auch „ foreground()“, „ clearForeground()“ und „ setBackground()“.

void QTextFormat::setLayoutDirection(Qt::LayoutDirection direction)

Legt die Layoutrichtung des Dokuments auf die angegebene „ direction “ fest.

Siehe auch layoutDirection().

void QTextFormat::setObjectIndex(int index)

Legt die Objekt index des Formatobjekts fest.

Siehe auch ` objectIndex()`.

void QTextFormat::setObjectType(int type)

Setzt den Objekttyp des Textformats auf „ type “.

Siehe auch „ ObjectTypes “ und „ objectType()“.

void QTextFormat::setProperty(int propertyId, const QList<QTextLength> &value)

Setzt den Wert der Eigenschaft, die durch propertyId angegeben wird, auf value.

Siehe auch „ property()“, „ lengthVectorProperty()“ und „ Property “.

void QTextFormat::setProperty(int propertyId, const QVariant &value)

Setzt die durch „ propertyId “ angegebene Eigenschaft auf den angegebenen Wert „ value “.

Siehe auch „ Property “.

QString QTextFormat::stringProperty(int propertyId) const

Gibt den Wert der durch ` propertyId` angegebenen Eigenschaft zurück; wenn die Eigenschaft nicht vom Typ ` QMetaType::QString ` ist, wird stattdessen eine leere Zeichenkette zurückgegeben.

Siehe auch „ setProperty()“, „ boolProperty()“, „ intProperty()“, „ doubleProperty()“, „ colorProperty()“, „ lengthProperty()“, „ lengthVectorProperty()“ und „ Property “.

void QTextFormat::swap(QTextFormat &other)

Tauscht dieses Textformat gegen „ other “ aus. Dieser Vorgang ist sehr schnell und schlägt niemals fehl.

QTextBlockFormat QTextFormat::toBlockFormat() const

Gibt dieses Format als Blockformat zurück.

QTextCharFormat QTextFormat::toCharFormat() const

Gibt dieses Format als Zeichenformat zurück.

QTextFrameFormat QTextFormat::toFrameFormat() const

Gibt dieses Format als Rahmenformat zurück.

QTextImageFormat QTextFormat::toImageFormat() const

Gibt dieses Format als Bildformat zurück.

QTextListFormat QTextFormat::toListFormat() const

Gibt dieses Format als Listenformat zurück.

QTextTableCellFormat QTextFormat::toTableCellFormat() const

Gibt dieses Format als Tabellenzellenformat zurück.

QTextTableFormat QTextFormat::toTableFormat() const

Gibt dieses Format als Tabellenformat zurück.

int QTextFormat::type() const

Gibt den Typ dieses Formats zurück.

Siehe auch FormatType.

QTextFormat::operator QVariant() const

Gibt das Textformat als QVariant

bool QTextFormat::operator!=(const QTextFormat &other) const

Gibt „ true “ zurück, wenn dieses Textformat sich vom Textformat „ other “ unterscheidet.

QTextFormat &QTextFormat::operator=(const QTextFormat &other)

Weist diesem Textformat das Textformat „ other “ zu und gibt eine Referenz auf dieses Textformat zurück.

bool QTextFormat::operator==(const QTextFormat &other) const

Gibt „ true “ zurück, wenn dieses Textformat mit dem Textformat „ other “ übereinstimmt.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.