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 |
- Liste aller Mitglieder, einschließlich geerbter Mitglieder
- QTextFormat ist Teil der Rich-Text-Verarbeitungs-APIs und der implizit gemeinsam genutzten Klassen.
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.
| Konstante | Wert | Beschreibung |
|---|---|---|
QTextFormat::InvalidFormat | -1 | Ein ungültiges Format, wie es vom Standardkonstruktor erstellt wurde |
QTextFormat::BlockFormat | 1 | Das Objekt formatiert einen Textblock |
QTextFormat::CharFormat | 2 | Das Objekt formatiert ein einzelnes Zeichen |
QTextFormat::ListFormat | 3 | Das Objekt formatiert eine Liste |
QTextFormat::FrameFormat | 5 | Das Objekt formatiert einen Rahmen |
QTextFormat::UserFormat | 100 |
Siehe auch QTextCharFormat, QTextBlockFormat, QTextListFormat, QTextTableFormat und type().
enum QTextFormat::ObjectTypes
Diese Enumeration beschreibt, mit welcher Art von „ QTextObject “ dieses Format verknüpft ist.
| Konstante | Wert | Beschreibung |
|---|---|---|
QTextFormat::NoObject | 0 | |
QTextFormat::ImageObject | 1 | |
QTextFormat::TableObject | 2 | |
QTextFormat::TableCellObject | 3 | |
QTextFormat::UserObject | 0x1000 | Das 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.
| Konstante | Wert | Beschreibung |
|---|---|---|
QTextFormat::PageBreak_Auto | 0 | Der Seitenumbruch wird automatisch in Abhängigkeit vom verfügbaren Platz auf der aktuellen Seite festgelegt |
QTextFormat::PageBreak_AlwaysBefore | 0x001 | Der Seitenumbruch erfolgt immer vor dem Absatz/der Tabelle |
QTextFormat::PageBreak_AlwaysAfter | 0x010 | Nach 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.
| Konstante | Wert | Beschreibung |
|---|---|---|
QTextFormat::ObjectIndex | 0x0 | Der Index des formatierten Objekts. Siehe objectIndex(). |
Absatz- und Zeicheneigenschaften
| Konstante | Wert | Beschreibung |
|---|---|---|
QTextFormat::CssFloat | 0x0800 | Wie ein Rahmen relativ zum umgebenden Text positioniert ist |
QTextFormat::LayoutDirection | 0x0801 | Die Ausrichtungsrichtung des Textes im Dokument (Qt::LayoutDirection). |
QTextFormat::OutlinePen | 0x810 | |
QTextFormat::ForegroundBrush | 0x821 | |
QTextFormat::BackgroundBrush | 0x820 | |
QTextFormat::BackgroundImageUrl | 0x823 |
Absatzeigenschaften
| Konstante | Wert | Beschreibung |
|---|---|---|
QTextFormat::BlockAlignment | 0x1010 | |
QTextFormat::BlockTopMargin | 0x1030 | |
QTextFormat::BlockBottomMargin | 0x1031 | |
QTextFormat::BlockLeftMargin | 0x1032 | |
QTextFormat::BlockRightMargin | 0x1033 | |
QTextFormat::TextIndent | 0x1034 | |
QTextFormat::TabPositions | 0x1035 | Legt die Tabulatorpositionen fest. Die Tabulatorpositionen sind Strukturen vom Typ „ QTextOption::Tab “, die in einer „ QList “ gespeichert sind (intern in einer „ QList “ <QVariant>). |
QTextFormat::BlockIndent | 0x1040 | |
QTextFormat::LineHeight | 0x1048 | |
QTextFormat::LineHeightType | 0x1049 | |
QTextFormat::BlockNonBreakableLines | 0x1050 | |
QTextFormat::BlockTrailingHorizontalRulerWidth | 0x1060 | Die Breite eines horizontalen Linealelements. |
QTextFormat::HeadingLevel | 0x1070 | Die Ebene einer Überschrift; beispielsweise entspricht 1 einem HTML-H1-Tag, andernfalls 0. Dieser Enum-Wert wurde in Qt 5.12 hinzugefügt. |
QTextFormat::BlockCodeFence | 0x1091 | Das 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::BlockQuoteLevel | 0x1080 | Die 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::BlockCodeLanguage | 0x1090 | Die 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::BlockMarker | 0x10A0 | Die „ type of adornment “, die neben dem Block angezeigt werden soll. Dieser Enum-Wert wurde in Qt 5.14 hinzugefügt. |
Zeicheneigenschaften
| Konstante | Wert | Beschreibung |
|---|---|---|
QTextFormat::FontFamily | 0x2000 | e{Diese Eigenschaft ist veraltet.} Verwenden Sie stattdessen QTextFormat::FontFamilies. |
QTextFormat::FontFamilies | 0x1FE7 | |
QTextFormat::FontStyleName | 0x1FE8 | |
QTextFormat::FontPointSize | 0x2001 | |
QTextFormat::FontPixelSize | 0x2009 | |
QTextFormat::FontSizeAdjustment | 0x2002 | Gibt einen ganzzahligen Anpassungswert an, der zur mit ` FontPointSize ` oder ` FontPixelSize` festgelegten Basis-Schriftgröße addiert wird. |
QTextFormat::FontFixedPitch | 0x2008 | |
QTextFormat::FontWeight | 0x2003 | |
QTextFormat::FontItalic | 0x2004 | |
QTextFormat::FontUnderline | 0x2005 | Diese Eigenschaft ist veraltet. Verwenden Sie stattdessen QTextFormat::TextUnderlineStyle. |
QTextFormat::FontOverline | 0x2006 | |
QTextFormat::FontStrikeOut | 0x2007 | |
QTextFormat::FontCapitalization | FirstFontProperty | Legt die Art der Großschreibung fest, die auf den Text angewendet werden soll. |
QTextFormat::FontLetterSpacingType | 0x1FE9 | Legt die Bedeutung der Eigenschaft „FontLetterSpacing“ fest. Der Standardwert ist „ QFont::PercentageSpacing “. |
QTextFormat::FontLetterSpacing | 0x1FE1 | Ä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::FontWordSpacing | 0x1FE2 | Ä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::FontStretch | 0x1FEA | Entspricht der Eigenschaft „ QFont::Stretch “ |
QTextFormat::FontStyleHint | 0x1FE3 | Entspricht der Eigenschaft „ QFont::StyleHint “ |
QTextFormat::FontStyleStrategy | 0x1FE4 | Entspricht der Eigenschaft „ QFont::StyleStrategy “ |
QTextFormat::FontKerning | 0x1FE5 | Gibt an, ob für die Schriftart Kerning aktiviert ist. |
QTextFormat::FontHintingPreference | 0x1FE6 | Steuert die Verwendung von Hinting entsprechend den Werten der Aufzählung „ QFont::HintingPreference “. |
QTextFormat::FontFeatures | 0x2010 | [seit 6.11] Weist typografischen Merkmalen Ganzzahlwerte zu. Weitere Informationen finden Sie unter „ QFont::setFeature()“. |
QTextFormat::FontVariableAxes | 0x2011 | [seit 6.11] Weist variablen Achsen in variablen Schriftarten Gleitkommazahlen zu. Weitere Informationen finden Sie unter ` QFont::setVariableAxis()`. |
QTextFormat::TextUnderlineColor | 0x2020 | Legt die Farbe fest, in der Unterstreichungen, Überstriche und Durchstreichungen gezeichnet werden. |
QTextFormat::TextVerticalAlignment | 0x2021 | Legt die Art der vertikalen Textausrichtung entsprechend den Werten der Enumeration „ QTextCharFormat::VerticalAlignment “ fest. |
QTextFormat::TextOutline | 0x2022 | Legt eine „ QPen “ fest, die zum Zeichnen des Textumrisses verwendet wird. |
QTextFormat::TextUnderlineStyle | 0x2023 | Legt den Stil der Textunterstreichung entsprechend den Werten der Enumeration „ QTextCharFormat::UnderlineStyle “ fest. |
QTextFormat::TextToolTip | 0x2024 | Legt den (optionalen) Tooltip fest, der für ein Textfragment angezeigt werden soll. |
QTextFormat::TextSuperScriptBaseline | 0x2025 | Legt die Grundlinie (in % der Höhe) von hochgestellten Texten fest. |
QTextFormat::TextSubScriptBaseline | 0x2026 | Legt die Grundlinie (in % der Höhe) von hochgestellten Texten fest. |
QTextFormat::TextBaselineOffset | 0x2027 | Legt 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::IsAnchor | 0x2030 | |
QTextFormat::AnchorHref | 0x2031 | |
QTextFormat::AnchorName | 0x2032 | |
QTextFormat::ObjectType | 0x2f00 |
Liste der Eigenschaften
| Konstante | Wert | Beschreibung |
|---|---|---|
QTextFormat::ListStyle | 0x3000 | Gibt den Stil an, der für die Elemente einer Liste verwendet wird, beschrieben durch die Werte der Enumeration „ QTextListFormat::Style “. |
QTextFormat::ListIndent | 0x3001 | Legt die Einrückung für eine Liste fest. |
QTextFormat::ListNumberPrefix | 0x3002 | Definiert den Text, der den Elementnummern in numerischen Listen vorangestellt wird. |
QTextFormat::ListNumberSuffix | 0x3003 | Definiert den Text, der an die Elementnummern in numerischen Listen angehängt wird. |
QTextFormat::ListStart (since Qt 6.6) | 0x3004 | Definiert den ersten Wert einer Liste. |
Tabellen- und Rahmeneigenschaften
| Konstante | Wert | Beschreibung |
|---|---|---|
QTextFormat::FrameBorder | 0x4000 | |
QTextFormat::FrameBorderBrush | 0x4009 | |
QTextFormat::FrameBorderStyle | 0x4010 | Siehe die Enumeration „ BorderStyle “. |
QTextFormat::FrameBottomMargin | 0x4006 | |
QTextFormat::FrameHeight | 0x4004 | |
QTextFormat::FrameLeftMargin | 0x4007 | |
QTextFormat::FrameMargin | 0x4001 | |
QTextFormat::FramePadding | 0x4002 | |
QTextFormat::FrameRightMargin | 0x4008 | |
QTextFormat::FrameTopMargin | 0x4005 | |
QTextFormat::FrameWidth | 0x4003 | |
QTextFormat::TableCellSpacing | 0x4102 | |
QTextFormat::TableCellPadding | 0x4103 | |
QTextFormat::TableColumns | 0x4100 | |
QTextFormat::TableColumnWidthConstraints | 0x4101 | |
QTextFormat::TableHeaderRowCount | 0x4104 | |
QTextFormat::TableBorderCollapse | 0x4105 | Legt die Eigenschaft „ QTextTableFormat::borderCollapse “ fest. |
Eigenschaften von Tabellenzellen
| Konstante | Wert |
|---|---|
QTextFormat::TableCellRowSpan | 0x4810 |
QTextFormat::TableCellColumnSpan | 0x4811 |
QTextFormat::TableCellLeftPadding | 0x4814 |
QTextFormat::TableCellRightPadding | 0x4815 |
QTextFormat::TableCellTopPadding | 0x4812 |
QTextFormat::TableCellBottomPadding | 0x4813 |
Tabellenzelleneigenschaften, die für die Verwendung bei aktiviertem „ QTextTableFormat::borderCollapse “ vorgesehen sind
| Konstante | Wert |
|---|---|
QTextFormat::TableCellTopBorder | 0x4816 |
QTextFormat::TableCellBottomBorder | 0x4817 |
QTextFormat::TableCellLeftBorder | 0x4818 |
QTextFormat::TableCellRightBorder | 0x4819 |
QTextFormat::TableCellTopBorderStyle | 0x481a |
QTextFormat::TableCellBottomBorderStyle | 0x481b |
QTextFormat::TableCellLeftBorderStyle | 0x481c |
QTextFormat::TableCellRightBorderStyle | 0x481d |
QTextFormat::TableCellTopBorderBrush | 0x481e |
QTextFormat::TableCellBottomBorderBrush | 0x481f |
QTextFormat::TableCellLeftBorderBrush | 0x4820 |
QTextFormat::TableCellRightBorderBrush | 0x4821 |
Bildeigenschaften
| Konstante | Wert | Beschreibung |
|---|---|---|
QTextFormat::ImageName | 0x5000 | Der Dateiname oder die Quelle des Bildes. |
QTextFormat::ImageTitle | 0x5001 | Das „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::ImageAltText | 0x5002 | Das „alt“-Attribut eines HTML-Bild-Tags oder die Bildbeschreibung in einem Markdown-Bildlink. Dieser Enum-Wert wurde in Qt 5.14 hinzugefügt. |
QTextFormat::ImageWidth | 0x5010 | |
QTextFormat::ImageHeight | 0x5011 | |
QTextFormat::ImageQuality | 0x5014 | |
QTextFormat::ImageMaxWidth | 0x5015 | Dieser Enum-Wert wurde in Qt 6.8 hinzugefügt. |
Auswahleigenschaften
| Konstante | Wert | Beschreibung |
|---|---|---|
QTextFormat::FullWidthSelection | 0x06000 | Wird dieser Wert für das `characterFormat` einer Auswahl festgelegt, wird die gesamte Breite des Textes als ausgewählt angezeigt. |
Seitenumbruch-Eigenschaften
| Konstante | Wert | Beschreibung |
|---|---|---|
QTextFormat::PageBreakPolicy | 0x7000 | Legt fest, wie Seiten umgebrochen werden. Siehe die Enumeration „ PageBreakFlag “. |
QTextFormat::UserProperty | 0x100000 |
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.