QTextFormat Class
La classe QTextFormat fornisce informazioni di formattazione per un oggetto ` QTextDocument`. Per saperne di più...
| Intestazione: | #include <QTextFormat> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
| qmake: | QT += gui |
| Ereditato da: | QTextBlockFormat, QTextCharFormat, QTextFrameFormat e QTextListFormat |
- Elenco di tutti i membri, compresi quelli ereditati
- QTextFormat fa parte delle API per l'elaborazione di testo formattato e delle classi condivise implicitamente.
Nota: tutte le funzioni di questa classe sono rientranti.
Tipi pubblici
| 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 } |
Funzioni pubbliche
| 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 |
Descrizione dettagliata
Una classe QTextFormat è una classe generica utilizzata per descrivere il formato di parti di un documento ( QTextDocument). Le classi derivate QTextCharFormat, QTextBlockFormat, QTextListFormat e QTextTableFormat sono solitamente più utili e descrivono la formattazione applicata a parti specifiche del documento.
Un formato ha un tipo di formato ( FormatType ) che specifica i tipi di elementi di testo che può formattare; ad esempio, un blocco di testo, un elenco, una tabella, ecc. Un formato possiede inoltre varie proprietà (alcune specifiche per particolari tipi di formato), come descritto dall’enumerazione Property. Ad ogni proprietà corrisponde un elemento Property.
Il tipo di formato è indicato da ` type()` e il formato può essere verificato con ` isCharFormat()`, ` isBlockFormat()`, ` isListFormat()`, ` isTableFormat()`, ` isFrameFormat()` e ` isImageFormat()`. Se il tipo è determinato, può essere recuperato con ` toCharFormat()`, ` toBlockFormat()`, ` toListFormat()`, ` toTableFormat()`, ` toFrameFormat()` e ` toImageFormat()`.
Le proprietà di un formato possono essere impostate con le funzioni setProperty() e recuperate con boolProperty(), intProperty(), doubleProperty() e stringProperty(), a seconda dei casi. Tutti gli ID delle proprietà utilizzati nel formato possono essere recuperati con allPropertyIds(). È possibile unire un formato a un altro utilizzando merge().
L’indice dell’oggetto di un formato può essere impostato con setObjectIndex() e recuperato con objectIndex(). Questi metodi possono essere utilizzati per associare il formato a un QTextObject. Viene utilizzato per rappresentare elenchi, riquadri e tabelle all’interno del documento.
Vedi anche Elaborazione del testo formattato.
Documentazione sui tipi di membro
enum QTextFormat::FormatType
Questa enumerazione descrive l'elemento di testo che un oggetto ` QTextFormat ` sta formattando.
| Costante | Valore | Descrizione |
|---|---|---|
QTextFormat::InvalidFormat | -1 | Formato non valido, creato dal costruttore predefinito |
QTextFormat::BlockFormat | 1 | L'oggetto formatta un blocco di testo |
QTextFormat::CharFormat | 2 | L'oggetto impagina un singolo carattere |
QTextFormat::ListFormat | 3 | L'oggetto formatta un elenco |
QTextFormat::FrameFormat | 5 | L'oggetto impagina un riquadro |
QTextFormat::UserFormat | 100 |
Vedi anche QTextCharFormat, QTextBlockFormat, QTextListFormat, QTextTableFormat e type().
enum QTextFormat::ObjectTypes
Questa enumerazione descrive a quale tipo di QTextObject è associato questo formato.
| Costante | Valore | Descrizione |
|---|---|---|
QTextFormat::NoObject | 0 | |
QTextFormat::ImageObject | 1 | |
QTextFormat::TableObject | 2 | |
QTextFormat::TableCellObject | 3 | |
QTextFormat::UserObject | 0x1000 | Il primo oggetto che può essere utilizzato per scopi specifici dell'applicazione. |
Vedi anche QTextObject, QTextTable e QTextObject::format().
enum QTextFormat::PageBreakFlag
flags QTextFormat::PageBreakFlags
Questa enumerazione descrive come viene eseguita l'interruzione di pagina durante la stampa. È associata alle proprietà CSS corrispondenti.
| Costante | Valore | Descrizione |
|---|---|---|
QTextFormat::PageBreak_Auto | 0 | L'interruzione di pagina viene determinata automaticamente in base allo spazio disponibile nella pagina corrente |
QTextFormat::PageBreak_AlwaysBefore | 0x001 | L'interruzione di pagina avviene sempre prima del paragrafo/tabella |
QTextFormat::PageBreak_AlwaysAfter | 0x010 | Viene sempre iniziata una nuova pagina dopo il paragrafo/la tabella |
Il tipo PageBreakFlags è un typedef per QFlags<PageBreakFlag>. Memorizza una combinazione OR di valori PageBreakFlag.
Vedi anche QTextBlockFormat::pageBreakPolicy(), QTextFrameFormat::pageBreakPolicy() e PageBreakPolicy.
enum QTextFormat::Property
Questa enumerazione descrive le diverse proprietà che un formato può avere.
| Costante | Valore | Descrizione |
|---|---|---|
QTextFormat::ObjectIndex | 0x0 | L'indice dell'oggetto formattato. Vedi objectIndex(). |
Proprietà di paragrafo e carattere
| Costante | Valore | Descrizione |
|---|---|---|
QTextFormat::CssFloat | 0x0800 | Posizione di un riquadro rispetto al testo circostante |
QTextFormat::LayoutDirection | 0x0801 | La direzione di impaginazione del testo nel documento (Qt::LayoutDirection). |
QTextFormat::OutlinePen | 0x810 | |
QTextFormat::ForegroundBrush | 0x821 | |
QTextFormat::BackgroundBrush | 0x820 | |
QTextFormat::BackgroundImageUrl | 0x823 |
Proprietà del paragrafo
| Costante | Valore | Descrizione |
|---|---|---|
QTextFormat::BlockAlignment | 0x1010 | |
QTextFormat::BlockTopMargin | 0x1030 | |
QTextFormat::BlockBottomMargin | 0x1031 | |
QTextFormat::BlockLeftMargin | 0x1032 | |
QTextFormat::BlockRightMargin | 0x1033 | |
QTextFormat::TextIndent | 0x1034 | |
QTextFormat::TabPositions | 0x1035 | Specifica le posizioni dei tabulatori. Le posizioni dei tabulatori sono strutture di tipo QTextOption::Tab che vengono memorizzate in un QList (internamente, in un QList<QVariant>). |
QTextFormat::BlockIndent | 0x1040 | |
QTextFormat::LineHeight | 0x1048 | |
QTextFormat::LineHeightType | 0x1049 | |
QTextFormat::BlockNonBreakableLines | 0x1050 | |
QTextFormat::BlockTrailingHorizontalRulerWidth | 0x1060 | La larghezza di un elemento righello orizzontale. |
QTextFormat::HeadingLevel | 0x1070 | Il livello di un titolo; ad esempio, 1 corrisponde a un tag HTML H1, altrimenti 0. Questo valore dell'enumerazione è stato aggiunto in Qt 5.12. |
QTextFormat::BlockCodeFence | 0x1091 | Il carattere utilizzato nelle «recinzioni» attorno a un blocco di codice Markdown. Se il blocco di codice è stato indentato anziché racchiuso tra recinzioni, il blocco non dovrebbe avere questa proprietà. Questo valore di enumerazione è stato aggiunto in Qt 5.14. |
QTextFormat::BlockQuoteLevel | 0x1080 | La profondità della citazione annidata in questo blocco: 1 indica che il blocco è una citazione di primo livello. I blocchi che non sono citazioni non dovrebbero avere questa proprietà. Questo valore di enumerazione è stato aggiunto in Qt 5.14. |
QTextFormat::BlockCodeLanguage | 0x1090 | Il linguaggio di programmazione in un blocco preformattato o di codice. I blocchi che non contengono codice non dovrebbero avere questa proprietà. Questo valore di enumerazione è stato aggiunto in Qt 5.14. |
QTextFormat::BlockMarker | 0x10A0 | L’ type of adornment da visualizzare accanto al blocco. Questo valore di enumerazione è stato aggiunto in Qt 5.14. |
Proprietà dei caratteri
| Costante | Valore | Descrizione |
|---|---|---|
QTextFormat::FontFamily | 0x2000 | e{Questa proprietà è stata deprecata.} Utilizzare invece QTextFormat::FontFamilies. |
QTextFormat::FontFamilies | 0x1FE7 | |
QTextFormat::FontStyleName | 0x1FE8 | |
QTextFormat::FontPointSize | 0x2001 | |
QTextFormat::FontPixelSize | 0x2009 | |
QTextFormat::FontSizeAdjustment | 0x2002 | Specifica una correzione intera da aggiungere alla dimensione di base del carattere impostata tramite ` FontPointSize ` o ` FontPixelSize`. |
QTextFormat::FontFixedPitch | 0x2008 | |
QTextFormat::FontWeight | 0x2003 | |
QTextFormat::FontItalic | 0x2004 | |
QTextFormat::FontUnderline | 0x2005 | Questa proprietà è stata deprecata. Utilizzare invece QTextFormat::TextUnderlineStyle. |
QTextFormat::FontOverline | 0x2006 | |
QTextFormat::FontStrikeOut | 0x2007 | |
QTextFormat::FontCapitalization | FirstFontProperty | Specifica il tipo di maiuscolo da applicare al testo. |
QTextFormat::FontLetterSpacingType | 0x1FE9 | Specifica il significato della proprietà FontLetterSpacing. Il valore predefinito è QFont::PercentageSpacing. |
QTextFormat::FontLetterSpacing | 0x1FE1 | Modifica la spaziatura predefinita tra le singole lettere del font. Il valore viene specificato come percentuale o valore assoluto, a seconda di FontLetterSpacingType. Il valore predefinito è 100%. |
QTextFormat::FontWordSpacing | 0x1FE2 | Modifica la spaziatura predefinita tra le singole parole. Un valore positivo aumenta la spaziatura tra le parole di un numero corrispondente di pixel; un valore negativo la riduce. |
QTextFormat::FontStretch | 0x1FEA | Corrisponde alla proprietà QFont::Stretch |
QTextFormat::FontStyleHint | 0x1FE3 | Corrisponde alla proprietà QFont::StyleHint |
QTextFormat::FontStyleStrategy | 0x1FE4 | Corrisponde alla proprietà QFont::StyleStrategy |
QTextFormat::FontKerning | 0x1FE5 | Specifica se il kerning è abilitato per il font. |
QTextFormat::FontHintingPreference | 0x1FE6 | Controlla l’uso dell’hinting in base ai valori dell’enumerazione QFont::HintingPreference. |
QTextFormat::FontFeatures | 0x2010 | [dalla versione 6.11] Assegna numeri interi alle caratteristiche tipografiche. Per ulteriori informazioni, consultare QFont::setFeature(). |
QTextFormat::FontVariableAxes | 0x2011 | [dalla versione 6.11] Assegna numeri in virgola mobile agli assi variabili nei font variabili. Per ulteriori informazioni, vedere QFont::setVariableAxis(). |
QTextFormat::TextUnderlineColor | 0x2020 | Specifica il colore con cui disegnare le sottolineature, le sovrascrizioni e le cancellature. |
QTextFormat::TextVerticalAlignment | 0x2021 | Specifica il tipo di allineamento verticale del testo in base ai valori dell’enumerazione QTextCharFormat::VerticalAlignment. |
QTextFormat::TextOutline | 0x2022 | Specifica un QPen utilizzato per disegnare il contorno del testo. |
QTextFormat::TextUnderlineStyle | 0x2023 | Specifica lo stile della sottolineatura del testo in base ai valori dell’enumerazione QTextCharFormat::UnderlineStyle. |
QTextFormat::TextToolTip | 0x2024 | Specifica il tooltip (opzionale) da visualizzare per un frammento di testo. |
QTextFormat::TextSuperScriptBaseline | 0x2025 | Specifica la linea di base (in % dell’altezza) dei testi in apice. |
QTextFormat::TextSubScriptBaseline | 0x2026 | Specifica la linea di base (in % dell’altezza) dei testi in pedice. |
QTextFormat::TextBaselineOffset | 0x2027 | Specifica la linea di base (in % dell'altezza) del testo. Un valore positivo sposta il testo verso l'alto, della percentuale corrispondente; un valore negativo lo sposta verso il basso. |
QTextFormat::IsAnchor | 0x2030 | |
QTextFormat::AnchorHref | 0x2031 | |
QTextFormat::AnchorName | 0x2032 | |
QTextFormat::ObjectType | 0x2f00 |
Proprietà dell’elenco
| Costante | Valore | Descrizione |
|---|---|---|
QTextFormat::ListStyle | 0x3000 | Specifica lo stile utilizzato per le voci di un elenco, descritto dai valori dell'enumerazione QTextListFormat::Style. |
QTextFormat::ListIndent | 0x3001 | Specifica la quantità di rientro utilizzata per un elenco. |
QTextFormat::ListNumberPrefix | 0x3002 | Definisce il testo che viene anteposto ai numeri delle voci negli elenchi numerici. |
QTextFormat::ListNumberSuffix | 0x3003 | Definisce il testo che viene aggiunto ai numeri delle voci negli elenchi numerici. |
QTextFormat::ListStart (since Qt 6.6) | 0x3004 | Definisce il primo valore di un elenco. |
Proprietà di tabelle e cornici
| Costante | Valore | Descrizione |
|---|---|---|
QTextFormat::FrameBorder | 0x4000 | |
QTextFormat::FrameBorderBrush | 0x4009 | |
QTextFormat::FrameBorderStyle | 0x4010 | Vedi l'enumerazione " 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 | Specifica la proprietà ` QTextTableFormat::borderCollapse `. |
Proprietà delle celle della tabella
| Costante | Valore |
|---|---|
QTextFormat::TableCellRowSpan | 0x4810 |
QTextFormat::TableCellColumnSpan | 0x4811 |
QTextFormat::TableCellLeftPadding | 0x4814 |
QTextFormat::TableCellRightPadding | 0x4815 |
QTextFormat::TableCellTopPadding | 0x4812 |
QTextFormat::TableCellBottomPadding | 0x4813 |
Proprietà delle celle della tabella destinate all'uso con l'QTextTableFormat::borderCollapse e abilitato
| Costante | Valore |
|---|---|
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 |
Proprietà immagine
| Costante | Valore | Descrizione |
|---|---|---|
QTextFormat::ImageName | 0x5000 | Il nome del file o l'origine dell'immagine. |
QTextFormat::ImageTitle | 0x5001 | L'attributo title di un tag immagine HTML, oppure la stringa racchiusa tra virgolette che segue l'URL in un link immagine Markdown. Questo valore dell'enumerazione è stato aggiunto in Qt 5.14. |
QTextFormat::ImageAltText | 0x5002 | L'attributo alt di un tag immagine HTML oppure la descrizione dell'immagine in un link immagine Markdown. Questo valore dell'enumerazione è stato aggiunto in Qt 5.14. |
QTextFormat::ImageWidth | 0x5010 | |
QTextFormat::ImageHeight | 0x5011 | |
QTextFormat::ImageQuality | 0x5014 | |
QTextFormat::ImageMaxWidth | 0x5015 | Questo valore di enumerazione è stato aggiunto in Qt 6.8. |
Proprietà di selezione
| Costante | Valore | Descrizione |
|---|---|---|
QTextFormat::FullWidthSelection | 0x06000 | Se impostato su characterFormat di una selezione, l'intera larghezza del testo verrà visualizzata come selezionata. |
Proprietà di interruzione di pagina
| Costante | Valore | Descrizione |
|---|---|---|
QTextFormat::PageBreakPolicy | 0x7000 | Specifica come vengono inserite le interruzioni di pagina. Vedere l'enumerazione PageBreakFlag. |
QTextFormat::UserProperty | 0x100000 |
Vedi anche property() e setProperty().
Documentazione delle funzioni membro
QTextFormat::QTextFormat()
Crea un nuovo formato di testo con un’ InvalidFormat.
Vedi anche FormatType.
[explicit] QTextFormat::QTextFormat(int type)
Crea un nuovo formato di testo basato su type.
Vedi anche FormatType.
QTextFormat::QTextFormat(const QTextFormat &other)
Crea un nuovo formato di testo con gli stessi attributi del formato di testo “ other ”.
[noexcept] QTextFormat::~QTextFormat()
Elimina questo formato di testo.
QBrush QTextFormat::background() const
Restituisce il pennello utilizzato per colorare lo sfondo del documento.
Vedi anche setBackground(), clearBackground() e foreground().
bool QTextFormat::boolProperty(int propertyId) const
Restituisce il valore della proprietà specificata da propertyId. Se la proprietà non è di tipo QTextFormat::Bool, viene restituito invece false.
Vedi anche setProperty(), intProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthProperty(), lengthVectorProperty() e Property.
QBrush QTextFormat::brushProperty(int propertyId) const
Restituisce il valore della proprietà specificata da propertyId; se la proprietà non è di tipo QMetaType::QBrush, viene restituito invece Qt::NoBrush.
Vedi anche setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), lengthProperty(), lengthVectorProperty() e Property.
void QTextFormat::clearBackground()
Cancella il pennello utilizzato per dipingere lo sfondo del documento. Verrà utilizzato il pennello predefinito.
Vedi anche background(), setBackground() e clearForeground().
void QTextFormat::clearForeground()
Cancella il pennello utilizzato per dipingere il primo piano del documento. Verrà utilizzato il pennello predefinito.
Vedi anche foreground(), setForeground() e clearBackground().
void QTextFormat::clearProperty(int propertyId)
Cancella il valore della proprietà specificata da propertyId
Vedi anche Property.
QColor QTextFormat::colorProperty(int propertyId) const
Restituisce il valore della proprietà specificata da propertyId; se la proprietà non è di tipo QMetaType::QColor, viene invece restituito un colore non valido.
Vedi anche setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), lengthProperty(), lengthVectorProperty() e Property.
qreal QTextFormat::doubleProperty(int propertyId) const
Restituisce il valore della proprietà specificata da propertyId. Se la proprietà non è di tipo QMetaType::Double o QMetaType::Float, viene restituito invece 0.
Vedi anche setProperty(), boolProperty(), intProperty(), stringProperty(), colorProperty(), lengthProperty(), lengthVectorProperty() e Property.
QBrush QTextFormat::foreground() const
Restituisce il pennello utilizzato per il rendering dei dettagli in primo piano, quali testo, contorni delle cornici e bordi delle tabelle.
Vedi anche setForeground(), clearForeground() e background().
bool QTextFormat::hasProperty(int propertyId) const
Restituisce true se il formato di testo possiede una proprietà con l'propertyId specificato; in caso contrario, restituisce false.
Vedi anche properties() e Property.
int QTextFormat::intProperty(int propertyId) const
Restituisce il valore della proprietà specificata da ` propertyId`. Se la proprietà non è di tipo `QTextFormat::Integer`, viene restituito invece 0.
Vedi anche setProperty(), boolProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthProperty(), lengthVectorProperty() e Property.
bool QTextFormat::isBlockFormat() const
Restituisce " true " se questo formato di testo è un " BlockFormat"; in caso contrario, restituisce " false".
bool QTextFormat::isCharFormat() const
Restituisce ` true ` se questo formato di testo è un ` CharFormat`; altrimenti restituisce ` false`.
bool QTextFormat::isEmpty() const
Restituisce true se il formato non contiene alcuna proprietà; false in caso contrario.
Vedi anche propertyCount() e properties().
bool QTextFormat::isFrameFormat() const
Restituisce " true " se questo formato di testo è un " FrameFormat"; altrimenti restituisce " false".
bool QTextFormat::isImageFormat() const
Restituisce ` true ` se questo formato di testo è un formato immagine; altrimenti restituisce ` false`.
bool QTextFormat::isListFormat() const
Restituisce “ true ” se questo formato di testo è “ ListFormat ”; altrimenti restituisce “ false ”.
bool QTextFormat::isTableCellFormat() const
Restituisce “ true ” se questo formato di testo è un “ TableCellFormat ”; altrimenti restituisce “ false ”.
bool QTextFormat::isTableFormat() const
Restituisce “ true ” se il formato di testo specificato è “ TableFormat ”; in caso contrario, restituisce “ false ”.
bool QTextFormat::isValid() const
Restituisce ` true ` se il formato è valido (ovvero non è ` InvalidFormat`); altrimenti restituisce ` false`.
Qt::LayoutDirection QTextFormat::layoutDirection() const
Restituisce la direzione di impaginazione del documento.
Vedi anche setLayoutDirection().
QTextLength QTextFormat::lengthProperty(int propertyId) const
Restituisce il valore della proprietà specificata all'indirizzo propertyId.
Vedi anche setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthVectorProperty() e Property.
QList<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const
Restituisce il valore della proprietà specificata da propertyId. Se la proprietà non è di tipo QTextFormat::LengthVector, viene restituita invece una lista vuota.
Vedi anche setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthProperty() e Property.
void QTextFormat::merge(const QTextFormat &other)
Unisce il formato other con questo formato; in caso di conflitti, prevale il formato other.
int QTextFormat::objectIndex() const
Restituisce l'indice dell'oggetto di formato oppure -1 se l'oggetto di formato non è valido.
Vedi anche setObjectIndex().
int QTextFormat::objectType() const
Restituisce il tipo di oggetto del formato di testo.
Vedi anche ObjectTypes e setObjectType().
QPen QTextFormat::penProperty(int propertyId) const
Restituisce il valore della proprietà specificata da propertyId; se la proprietà non è di tipo QMetaType::QPen, viene restituito invece Qt::NoPen.
Vedi anche setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), lengthProperty(), lengthVectorProperty() e Property.
QMap<int, QVariant> QTextFormat::properties() const
Restituisce una mappa contenente tutte le proprietà di questo formato di testo.
QVariant QTextFormat::property(int propertyId) const
Restituisce la proprietà specificata dall'propertyId specificato.
Vedi anche setProperty() e Property.
int QTextFormat::propertyCount() const
Restituisce il numero di proprietà memorizzate nel formato.
void QTextFormat::setBackground(const QBrush &brush)
Imposta il pennello da utilizzare per dipingere lo sfondo del documento in base all'brush e specificata.
Vedi anche background(), clearBackground() e setForeground().
void QTextFormat::setForeground(const QBrush &brush)
Imposta il pennello di primo piano sul valore specificato brush. Il pennello di primo piano viene utilizzato principalmente per il rendering del testo.
Vedi anche foreground(), clearForeground() e setBackground().
void QTextFormat::setLayoutDirection(Qt::LayoutDirection direction)
Imposta la direzione di impaginazione del documento sul valore specificato direction.
Vedi anche layoutDirection().
void QTextFormat::setObjectIndex(int index)
Imposta l'index e dell'oggetto di formato.
Vedi anche ` objectIndex()`.
void QTextFormat::setObjectType(int type)
Imposta il tipo di oggetto del formato di testo su “ type ”.
Vedi anche ` ObjectTypes ` e ` objectType()`.
void QTextFormat::setProperty(int propertyId, const QList<QTextLength> &value)
Imposta il valore della proprietà indicata da propertyId su value.
Vedi anche property(), lengthVectorProperty() e Property.
void QTextFormat::setProperty(int propertyId, const QVariant &value)
Imposta la proprietà specificata dall'propertyId sul valore indicato value.
Vedi anche Property.
QString QTextFormat::stringProperty(int propertyId) const
Restituisce il valore della proprietà specificata da propertyId; se la proprietà non è di tipo QMetaType::QString, viene restituita invece una stringa vuota.
Vedi anche setProperty(), boolProperty(), intProperty(), doubleProperty(), colorProperty(), lengthProperty(), lengthVectorProperty() e Property.
void QTextFormat::swap(QTextFormat &other)
Sostituisce questo formato di testo con other. Questa operazione è molto veloce e non fallisce mai.
QTextBlockFormat QTextFormat::toBlockFormat() const
Restituisce questo formato come formato a blocchi.
QTextCharFormat QTextFormat::toCharFormat() const
Restituisce questo formato come formato di caratteri.
QTextFrameFormat QTextFormat::toFrameFormat() const
Restituisce questo formato come formato di fotogramma.
QTextImageFormat QTextFormat::toImageFormat() const
Restituisce questo formato come formato immagine.
QTextListFormat QTextFormat::toListFormat() const
Restituisce questo formato sotto forma di elenco.
QTextTableCellFormat QTextFormat::toTableCellFormat() const
Restituisce questo formato come formato di cella di tabella.
QTextTableFormat QTextFormat::toTableFormat() const
Restituisce questo formato sotto forma di tabella.
int QTextFormat::type() const
Restituisce il tipo di questo formato.
Vedi anche FormatType.
QTextFormat::operator QVariant() const
Restituisce il formato di testo come un QVariant
bool QTextFormat::operator!=(const QTextFormat &other) const
Restituisce " true " se questo formato di testo è diverso dal formato di testo " other ".
QTextFormat &QTextFormat::operator=(const QTextFormat &other)
Assegna il formato di testo " other " a questo formato di testo e restituisce un riferimento a quest'ultimo.
bool QTextFormat::operator==(const QTextFormat &other) const
Restituisce " true " se questo formato di testo è uguale al formato di testo " other ".
© 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.