このページでは

QTextFormat Class

QTextFormat クラスは、QTextDocument に対する書式設定情報を提供します。詳細...

ヘッダー: #include <QTextFormat>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
継承元:

QTextBlockFormat、QTextCharFormat 、QTextFrameFormat 、およびQTextListFormat

注:このクラスのすべての関数は再入可能です。

パブリック型

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 }

パブリック関数

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

詳細な説明

QTextFormat は、QTextDocument の各部分の書式を記述するために使用されるジェネリッククラスです。派生クラスのQTextCharFormat 、QTextBlockFormat 、QTextListFormat 、およびQTextTableFormat は通常、より有用であり、ドキュメントの特定の部分に適用される書式を記述します。

フォーマットには、FormatType があり、これによってフォーマット可能なテキスト項目の種類(例:テキストブロック、リスト、表など)が指定されます。また、フォーマットには、Property列挙型で定義されているように、さまざまなプロパティ(特定のフォーマットタイプに固有のものも含む)があります。すべてのプロパティには、対応するPropertyがあります。

書式タイプはtype()によって指定され、書式はisCharFormat()、isBlockFormat()、isListFormat()、isTableFormat()、isFrameFormat()、およびisImageFormat()を使用して確認できます。タイプが特定された場合、toCharFormat()、toBlockFormat()、toListFormat()、toTableFormat()、toFrameFormat()、およびtoImageFormat()を使用して取得できます。

フォーマットのプロパティは、setProperty() 関数で設定でき、boolProperty()、intProperty()、doubleProperty()、およびstringProperty() を適宜使用して取得できます。フォーマットで使用されるすべてのプロパティ ID は、allPropertyIds() で取得できます。merge() を使用すると、あるフォーマットを別のフォーマットにマージできます。

フォーマットのオブジェクトインデックスは、setObjectIndex() で設定し、objectIndex() で取得できます。これらのメソッドを使用して、フォーマットをQTextObject と関連付けることができます。これは、ドキュメント内のリスト、フレーム、および表を表すために使用されます。

「リッチテキスト処理」も参照してください 。

メンバ型のドキュメント

enum QTextFormat::FormatType

この列挙型は、QTextFormat オブジェクトが書式設定を行っているテキスト項目を表します。

定数値説明
QTextFormat::InvalidFormat-1デフォルトコンストラクタによって作成された無効なフォーマット
QTextFormat::BlockFormat1デフォルトのコンストラクタによって生成された無効な書式
QTextFormat::CharFormat2オブジェクトが単一の文字をフォーマットします
QTextFormat::ListFormat3オブジェクトがリストの書式設定を行います
QTextFormat::FrameFormat5オブジェクトがフレームの書式設定を行います
QTextFormat::UserFormat100 

関連項目: QTextCharFormat 、QTextBlockFormat 、QTextListFormat 、QTextTableFormat 、およびtype()。

enum QTextFormat::ObjectTypes

この列挙型は、このフォーマットがどの種類のQTextObject に関連付けられているかを表します。

定数値説明
QTextFormat::NoObject0 
QTextFormat::ImageObject1 
QTextFormat::TableObject2 
QTextFormat::TableCellObject3 
QTextFormat::UserObject0x1000アプリケーション固有の目的で使用できる最初のオブジェクト。

QTextObject 、QTextTable 、およびQTextObject::format()も参照してください 。

enum QTextFormat::PageBreakFlag
flags QTextFormat::PageBreakFlags

この列挙型は、印刷時の改ページ処理の方法を定義します。これは、対応する CSS プロパティにマッピングされます。

定数値説明
QTextFormat::PageBreak_Auto0現在のページの空きスペースに応じて、改ページが自動的に決定されます
QTextFormat::PageBreak_AlwaysBefore0x001段落または表の直前で常に改ページが行われます
QTextFormat::PageBreak_AlwaysAfter0x010段落または表の後に必ず新しいページが開始される

PageBreakFlags 型は、QFlags<PageBreakFlag> の typedef です。これは、PageBreakFlag 値の論理和(OR)を格納します。

関連項目: QTextBlockFormat::pageBreakPolicy()、QTextFrameFormat::pageBreakPolicy()、およびPageBreakPolicy 。

enum QTextFormat::Property

この列挙型は、フォーマットが持つさまざまなプロパティを表します。

定数値説明
QTextFormat::ObjectIndex0x0書式設定されたオブジェクトのインデックス。objectIndex() を参照してください。

段落および文字のプロパティ

定数値説明
QTextFormat::CssFloat0x0800フレームが周囲のテキストに対してどのように配置されるか
QTextFormat::LayoutDirection0x0801文書内のテキストのレイアウト方向(Qt::LayoutDirection )。
QTextFormat::OutlinePen0x810 
QTextFormat::ForegroundBrush0x821 
QTextFormat::BackgroundBrush0x820 
QTextFormat::BackgroundImageUrl0x823 

段落のプロパティ

定数値説明
QTextFormat::BlockAlignment0x1010 
QTextFormat::BlockTopMargin0x1030 
QTextFormat::BlockBottomMargin0x1031 
QTextFormat::BlockLeftMargin0x1032 
QTextFormat::BlockRightMargin0x1033 
QTextFormat::TextIndent0x1034 
QTextFormat::TabPositions0x1035タブの位置を指定します。タブの位置は、QTextOption::Tab の構造体であり、QList (内部的にはQList<QVariant>)に格納されます。
QTextFormat::BlockIndent0x1040 
QTextFormat::LineHeight0x1048 
QTextFormat::LineHeightType0x1049 
QTextFormat::BlockNonBreakableLines0x1050 
QTextFormat::BlockTrailingHorizontalRulerWidth0x1060水平ルーラー要素の幅。
QTextFormat::HeadingLevel0x1070見出しのレベル。例えば、1はHTMLのH1タグに対応し、それ以外は0となります。この列挙型値はQt 5.12で追加されました。
QTextFormat::BlockCodeFence0x1091Markdown コードブロックの周囲の「フェンス」に使用された文字。コードブロックがフェンスではなくインデントされている場合、このブロックにはこのプロパティは存在しないはずです。この列挙型値は Qt 5.14 で追加されました。
QTextFormat::BlockQuoteLevel0x1080このブロックにおけるネストされた引用符の深さ。1 は、そのブロックが最上位のブロック引用であることを意味します。ブロック引用ではないブロックには、このプロパティがあってはなりません。この列挙値は Qt 5.14 で追加されました。
QTextFormat::BlockCodeLanguage0x1090プレフォーマットされたブロックまたはコードブロック内のプログラミング言語。コードを含まないブロックには、このプロパティは存在してはなりません。この列挙型値は Qt 5.14 で追加されました。
QTextFormat::BlockMarker0x10A0ブロックの横に表示されるtype of adornment 。この列挙型値は Qt 5.14 で追加されました。

文字プロパティ

定数値説明
QTextFormat::FontFamily0x2000e{このプロパティは非推奨となっています。} 代わりに QTextFormat::FontFamilies を使用してください。
QTextFormat::FontFamilies0x1FE7 
QTextFormat::FontStyleName0x1FE8 
QTextFormat::FontPointSize0x2001 
QTextFormat::FontPixelSize0x2009 
QTextFormat::FontSizeAdjustment0x2002FontPointSize またはFontPixelSize を使用して設定された基本フォントサイズに加算される整数の調整値を指定します。
QTextFormat::FontFixedPitch0x2008 
QTextFormat::FontWeight0x2003 
QTextFormat::FontItalic0x2004 
QTextFormat::FontUnderline0x2005このプロパティは非推奨となりました。代わりに QTextFormat::TextUnderlineStyle を使用してください。
QTextFormat::FontOverline0x2006 
QTextFormat::FontStrikeOut0x2007 
QTextFormat::FontCapitalizationFirstFontPropertyテキストに適用する大文字化のタイプを指定します。
QTextFormat::FontLetterSpacingType0x1FE9FontLetterSpacing プロパティの意味を指定します。デフォルトはQFont::PercentageSpacing です。
QTextFormat::FontLetterSpacing0x1FE1フォント内の個々の文字間のデフォルトの間隔を変更します。値は、FontLetterSpacingType に応じて、パーセンテージまたは絶対値で指定されます。デフォルト値は 100% です。
QTextFormat::FontWordSpacing0x1FE2単語間のデフォルトの間隔を変更します。正の値は単語間隔をその値に相当するピクセル分広げ、負の値は間隔を狭めます。
QTextFormat::FontStretch0x1FEAQFont::Stretch プロパティに対応します
QTextFormat::FontStyleHint0x1FE3QFont::StyleHint プロパティに対応します
QTextFormat::FontStyleStrategy0x1FE4QFont::StyleStrategy プロパティに対応します
QTextFormat::FontKerning0x1FE5フォントのカーニングが有効になっているかどうかを指定します。
QTextFormat::FontHintingPreference0x1FE6QFont::HintingPreference 列挙型の値に基づいて、ヒンティングの使用を制御します。
QTextFormat::FontFeatures0x2010[6.11 以降] 組版機能に整数を割り当てます。詳細については、QFont::setFeature() を参照してください。
QTextFormat::FontVariableAxes0x2011[6.11 以降] 可変フォントの可変軸に浮動小数点数を割り当てます。詳細については、QFont::setVariableAxis() を参照してください。
QTextFormat::TextUnderlineColor0x2020下線、上線、および取り消し線を引く際の色を指定します。
QTextFormat::TextVerticalAlignment0x2021QTextCharFormat::VerticalAlignment 列挙型の値に基づいて、テキストの垂直方向の配置タイプを指定します。
QTextFormat::TextOutline0x2022テキストのアウトラインを描画するために使用するQPen を指定します。
QTextFormat::TextUnderlineStyle0x2023QTextCharFormat::UnderlineStyle 列挙型の値に基づいて、テキストの下線のスタイルを指定します。
QTextFormat::TextToolTip0x2024テキストの一部に対して表示される(オプションの)ツールチップを指定します。
QTextFormat::TextSuperScriptBaseline0x2025上付きテキストのベースライン(高さの%単位)を指定します。
QTextFormat::TextSubScriptBaseline0x2026下付きテキストのベースライン(高さの%単位)を指定します。
QTextFormat::TextBaselineOffset0x2027テキストのベースライン(高さの%単位)を指定します。正の値はテキストを対応する%分だけ上に移動させ、負の値は下に移動させます。
QTextFormat::IsAnchor0x2030 
QTextFormat::AnchorHref0x2031 
QTextFormat::AnchorName0x2032 
QTextFormat::ObjectType0x2f00 

リストのプロパティ

定数値説明
QTextFormat::ListStyle0x3000リストの項目に使用されるスタイルを指定します。これは、QTextListFormat::Style 列挙型の値によって定義されます。
QTextFormat::ListIndent0x3001リストに適用されるインデントの量を指定します。
QTextFormat::ListNumberPrefix0x3002番号付きリストの項目番号の前に付加されるテキストを定義します。
QTextFormat::ListNumberSuffix0x3003番号付きリストの項目番号の末尾に付加されるテキストを定義します。
QTextFormat::ListStart (since Qt 6.6)0x3004リストの最初の値を定義します。

テーブルおよびフレームのプロパティ

定数値説明
QTextFormat::FrameBorder0x4000 
QTextFormat::FrameBorderBrush0x4009 
QTextFormat::FrameBorderStyle0x4010BorderStyle 列挙型を参照してください。
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::TableBorderCollapse0x4105QTextTableFormat::borderCollapse プロパティを指定します。

表セルのプロパティ

定数値
QTextFormat::TableCellRowSpan0x4810
QTextFormat::TableCellColumnSpan0x4811
QTextFormat::TableCellLeftPadding0x4814
QTextFormat::TableCellRightPadding0x4815
QTextFormat::TableCellTopPadding0x4812
QTextFormat::TableCellBottomPadding0x4813

QTextTableFormat::borderCollapse が有効な場合に使用することを想定したテーブルセルのプロパティ

定数値
QTextFormat::TableCellTopBorder0x4816
QTextFormat::TableCellBottomBorder0x4817
QTextFormat::TableCellLeftBorder0x4818
QTextFormat::TableCellRightBorder0x4819
QTextFormat::TableCellTopBorderStyle0x481a
QTextFormat::TableCellBottomBorderStyle0x481b
QTextFormat::TableCellLeftBorderStyle0x481c
QTextFormat::TableCellRightBorderStyle0x481d
QTextFormat::TableCellTopBorderBrush0x481e
QTextFormat::TableCellBottomBorderBrush0x481f
QTextFormat::TableCellLeftBorderBrush0x4820
QTextFormat::TableCellRightBorderBrush0x4821

画像のプロパティ

定数値説明
QTextFormat::ImageName0x5000画像のファイル名またはソース。
QTextFormat::ImageTitle0x5001HTML の image タグの title 属性、または Markdown 画像リンクにおける URL の後に続く引用符で囲まれた文字列。この列挙型値は Qt 5.14 で追加されました。
QTextFormat::ImageAltText0x5002HTMLのimageタグのalt属性、またはMarkdownの画像リンク内の画像の説明。この列挙型値はQt 5.14で追加されました。
QTextFormat::ImageWidth0x5010 
QTextFormat::ImageHeight0x5011 
QTextFormat::ImageQuality0x5014 
QTextFormat::ImageMaxWidth0x5015この列挙型値は、Qt 6.8で追加されました。

選択プロパティ

定数値説明
QTextFormat::FullWidthSelection0x06000選択範囲の characterFormat に設定すると、テキストの全幅が選択された状態として表示されます。

改ページのプロパティ

定数値説明
QTextFormat::PageBreakPolicy0x7000ページの区切り方法を指定します。PageBreakFlag 列挙型を参照してください。
QTextFormat::UserProperty0x100000 

property() およびsetProperty()も参照してください 。

メンバー関数のドキュメント

QTextFormat::QTextFormat()

InvalidFormat を使用して、新しいテキスト形式を作成します。

「FormatType」も参照してください 。

[explicit] QTextFormat::QTextFormat(int type)

指定されたtype の新しいテキスト形式を作成します。

「FormatType」も参照してください 。

QTextFormat::QTextFormat(const QTextFormat &other)

「other 」テキスト形式と同じ属性を持つ新しいテキスト形式を作成します。

[noexcept] QTextFormat::~QTextFormat()

このテキスト形式を削除します。

QBrush QTextFormat::background() const

ドキュメントの背景の描画に使用されたブラシを返します。

setBackground()、clearBackground()、およびforeground()も参照してください 。

bool QTextFormat::boolProperty(int propertyId) const

propertyId で指定されたプロパティの値を返します。プロパティが QTextFormat::Bool 型でない場合は、代わりに false が返されます。

関連項目: setProperty()、intProperty()、doubleProperty()、stringProperty()、colorProperty()、lengthProperty()、lengthVectorProperty()、およびProperty 。

QBrush QTextFormat::brushProperty(int propertyId) const

propertyId で指定されたプロパティの値を返します。プロパティがQMetaType::QBrush 型でない場合は、代わりにQt::NoBrush が返されます。

関連項目: setProperty()、boolProperty()、intProperty()、doubleProperty()、stringProperty()、lengthProperty()、lengthVectorProperty()、およびProperty 。

void QTextFormat::clearBackground()

ドキュメントの背景の描画に使用されたブラシをクリアします。デフォルトのブラシが使用されます。

background()、setBackground()、およびclearForeground()も参照してください 。

void QTextFormat::clearForeground()

ドキュメントの前景の描画に使用されたブラシをクリアします。デフォルトのブラシが使用されます。

foreground()、setForeground()、およびclearBackground()も参照してください 。

void QTextFormat::clearProperty(int propertyId)

指定されたプロパティの値をクリアします。propertyId

Propertyも参照してください 。

QColor QTextFormat::colorProperty(int propertyId) const

propertyId で指定されたプロパティの値を返します。プロパティがQMetaType::QColor 型でない場合は、代わりに無効な色が返されます。

関連項目: setProperty()、boolProperty()、intProperty()、doubleProperty()、stringProperty()、lengthProperty()、lengthVectorProperty()、およびProperty 。

qreal QTextFormat::doubleProperty(int propertyId) const

propertyId で指定されたプロパティの値を返します。プロパティの型がQMetaType::Double またはQMetaType::Float でない場合は、代わりに 0 が返されます。

関連項目: setProperty()、boolProperty()、intProperty()、stringProperty()、colorProperty()、lengthProperty()、lengthVectorProperty()、およびProperty 。

QBrush QTextFormat::foreground() const

テキスト、枠線の輪郭、表の枠線など、前景の詳細部分をレンダリングするために使用されるブラシを返します。

setForeground()、clearForeground()、およびbackground()も参照してください 。

bool QTextFormat::hasProperty(int propertyId) const

テキスト形式に、指定されたpropertyId を持つプロパティが存在する場合、true を返します。そうでない場合は、false を返します。

properties() およびPropertyも参照してください 。

int QTextFormat::intProperty(int propertyId) const

propertyId で指定されたプロパティの値を返します。プロパティが QTextFormat::Integer 型でない場合は、代わりに 0 が返されます。

関連項目: setProperty()、boolProperty()、doubleProperty()、stringProperty()、colorProperty()、lengthProperty()、lengthVectorProperty()、およびProperty 。

bool QTextFormat::isBlockFormat() const

このテキスト形式がBlockFormat である場合はtrue を返し、そうでない場合はfalse を返します。

bool QTextFormat::isCharFormat() const

このテキスト形式がCharFormat である場合はtrue を返し、そうでない場合はfalse を返します。

bool QTextFormat::isEmpty() const

フォーマットにプロパティが一切格納されていない場合は true を返し、それ以外の場合は false を返します。

propertyCount() およびproperties()も参照してください 。

bool QTextFormat::isFrameFormat() const

このテキスト形式がFrameFormat である場合はtrue を返し、そうでない場合はfalse を返します。

bool QTextFormat::isImageFormat() const

このテキスト形式が画像形式である場合は `true ` を返し、そうでない場合は `false` を返します。

bool QTextFormat::isListFormat() const

このテキスト形式が「ListFormat 」である場合は `true ` を返し、そうでない場合は `false` を返します。

bool QTextFormat::isTableCellFormat() const

このテキスト形式がTableCellFormat である場合はtrue を返し、そうでない場合はfalse を返します。

bool QTextFormat::isTableFormat() const

このテキスト形式がTableFormat である場合はtrue を返し、そうでない場合はfalse を返します。

bool QTextFormat::isValid() const

フォーマットが有効な場合(つまり、InvalidFormat ではない場合)、true を返します。それ以外の場合は、false を返します。

Qt::LayoutDirection QTextFormat::layoutDirection() const

ドキュメントのレイアウト方向を返します。

setLayoutDirection()も参照してください 。

QTextLength QTextFormat::lengthProperty(int propertyId) const

propertyId で指定されたプロパティの値を返します。

関連項目: setProperty()、boolProperty()、intProperty()、doubleProperty()、stringProperty()、colorProperty()、lengthVectorProperty()、およびProperty 。

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

propertyId で指定されたプロパティの値を返します。プロパティが QTextFormat::LengthVector 型でない場合は、代わりに空のリストが返されます。

関連項目: setProperty()、boolProperty()、intProperty()、doubleProperty()、stringProperty()、colorProperty()、lengthProperty()、およびProperty 。

void QTextFormat::merge(const QTextFormat &other)

other の形式とこの形式を統合します。競合がある場合は、other の形式が優先されます。

int QTextFormat::objectIndex() const

フォーマットオブジェクトのインデックスを返します。フォーマットオブジェクトが無効な場合は -1 を返します。

setObjectIndex()も参照してください 。

int QTextFormat::objectType() const

テキスト形式のオブジェクト型を返します。

ObjectTypes およびsetObjectType()も参照してください 。

QPen QTextFormat::penProperty(int propertyId) const

propertyId で指定されたプロパティの値を返します。プロパティがQMetaType::QPen 型でない場合は、代わりにQt::NoPen が返されます。

関連項目: setProperty()、boolProperty()、intProperty()、doubleProperty()、stringProperty()、lengthProperty()、lengthVectorProperty()、およびProperty 。

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

このテキスト形式のすべてのプロパティを含むマップを返します。

QVariant QTextFormat::property(int propertyId) const

指定されたpropertyId で指定されたプロパティを返します。

setProperty() およびPropertyも参照してください 。

int QTextFormat::propertyCount() const

その形式で保存されているプロパティの数を返します。

void QTextFormat::setBackground(const QBrush &brush)

ドキュメントの背景を描画するために使用するブラシを、指定された「brush 」に設定します。

background()、clearBackground()、およびsetForeground()も参照してください 。

void QTextFormat::setForeground(const QBrush &brush)

前景色ブラシを指定されたbrush に設定します。前景色ブラシは主にテキストの描画に使用されます。

foreground()、clearForeground()、およびsetBackground()も参照してください 。

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

ドキュメントのレイアウト方向を、指定されたdirection に設定します。

layoutDirection()も参照してください 。

void QTextFormat::setObjectIndex(int index)

フォーマットオブジェクトのオブジェクト `index` を設定します。

objectIndex()も参照してください 。

void QTextFormat::setObjectType(int type)

テキスト形式のオブジェクトタイプを「type 」に設定します。

「 ObjectTypes 」および「objectType()」も参照してください 。

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

propertyId で指定されたプロパティの値を、value に設定します。

property()、lengthVectorProperty()、およびPropertyも参照してください 。

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

propertyId で指定されたプロパティを、指定されたvalue に設定します。

「Property」も参照してください 。

QString QTextFormat::stringProperty(int propertyId) const

propertyId で指定されたプロパティの値を返します。プロパティがQMetaType::QString 型でない場合は、代わりに空の文字列が返されます。

関連項目: setProperty()、boolProperty()、intProperty()、doubleProperty()、colorProperty()、lengthProperty()、lengthVectorProperty()、およびProperty 。

void QTextFormat::swap(QTextFormat &other)

このテキスト形式をother と入れ替えます。この操作は非常に高速で、失敗することはありません。

QTextBlockFormat QTextFormat::toBlockFormat() const

このフォーマットをブロック形式として返します。

QTextCharFormat QTextFormat::toCharFormat() const

このフォーマットを文字列形式として返します。

QTextFrameFormat QTextFormat::toFrameFormat() const

このフォーマットをフレームフォーマットとして返します。

QTextImageFormat QTextFormat::toImageFormat() const

このフォーマットを画像形式として返します。

QTextListFormat QTextFormat::toListFormat() const

この形式をリスト形式として返します。

QTextTableCellFormat QTextFormat::toTableCellFormat() const

この書式をテーブルのセル書式として返します。

QTextTableFormat QTextFormat::toTableFormat() const

この形式をテーブル形式で返します。

int QTextFormat::type() const

このフォーマットの型を返します。

FormatTypeも参照してください 。

QTextFormat::operator QVariant() const

テキスト形式をQVariant

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

このテキスト形式が「other 」のテキスト形式と異なる場合、true を返します。

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

このテキスト形式に「other 」テキスト形式を割り当て、このテキスト形式への参照を返します。

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

このテキスト形式が「other 」テキスト形式と同じである場合、true を返します。

© 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.