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 |
- 継承されたメンバーを含むすべてのメンバーの一覧
- QTextFormatは、リッチテキスト処理APIおよび暗黙的に共有されるクラスの一部です。
注:このクラスのすべての関数は再入可能です。
パブリック型
| 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::BlockFormat | 1 | デフォルトのコンストラクタによって生成された無効な書式 |
QTextFormat::CharFormat | 2 | オブジェクトが単一の文字をフォーマットします |
QTextFormat::ListFormat | 3 | オブジェクトがリストの書式設定を行います |
QTextFormat::FrameFormat | 5 | オブジェクトがフレームの書式設定を行います |
QTextFormat::UserFormat | 100 |
関連項目: QTextCharFormat 、QTextBlockFormat 、QTextListFormat 、QTextTableFormat 、およびtype()。
enum QTextFormat::ObjectTypes
この列挙型は、このフォーマットがどの種類のQTextObject に関連付けられているかを表します。
| 定数 | 値 | 説明 |
|---|---|---|
QTextFormat::NoObject | 0 | |
QTextFormat::ImageObject | 1 | |
QTextFormat::TableObject | 2 | |
QTextFormat::TableCellObject | 3 | |
QTextFormat::UserObject | 0x1000 | アプリケーション固有の目的で使用できる最初のオブジェクト。 |
QTextObject 、QTextTable 、およびQTextObject::format()も参照してください 。
enum QTextFormat::PageBreakFlag
flags QTextFormat::PageBreakFlags
この列挙型は、印刷時の改ページ処理の方法を定義します。これは、対応する CSS プロパティにマッピングされます。
| 定数 | 値 | 説明 |
|---|---|---|
QTextFormat::PageBreak_Auto | 0 | 現在のページの空きスペースに応じて、改ページが自動的に決定されます |
QTextFormat::PageBreak_AlwaysBefore | 0x001 | 段落または表の直前で常に改ページが行われます |
QTextFormat::PageBreak_AlwaysAfter | 0x010 | 段落または表の後に必ず新しいページが開始される |
PageBreakFlags 型は、QFlags<PageBreakFlag> の typedef です。これは、PageBreakFlag 値の論理和(OR)を格納します。
関連項目: QTextBlockFormat::pageBreakPolicy()、QTextFrameFormat::pageBreakPolicy()、およびPageBreakPolicy 。
enum QTextFormat::Property
この列挙型は、フォーマットが持つさまざまなプロパティを表します。
| 定数 | 値 | 説明 |
|---|---|---|
QTextFormat::ObjectIndex | 0x0 | 書式設定されたオブジェクトのインデックス。objectIndex() を参照してください。 |
段落および文字のプロパティ
| 定数 | 値 | 説明 |
|---|---|---|
QTextFormat::CssFloat | 0x0800 | フレームが周囲のテキストに対してどのように配置されるか |
QTextFormat::LayoutDirection | 0x0801 | 文書内のテキストのレイアウト方向(Qt::LayoutDirection )。 |
QTextFormat::OutlinePen | 0x810 | |
QTextFormat::ForegroundBrush | 0x821 | |
QTextFormat::BackgroundBrush | 0x820 | |
QTextFormat::BackgroundImageUrl | 0x823 |
段落のプロパティ
| 定数 | 値 | 説明 |
|---|---|---|
QTextFormat::BlockAlignment | 0x1010 | |
QTextFormat::BlockTopMargin | 0x1030 | |
QTextFormat::BlockBottomMargin | 0x1031 | |
QTextFormat::BlockLeftMargin | 0x1032 | |
QTextFormat::BlockRightMargin | 0x1033 | |
QTextFormat::TextIndent | 0x1034 | |
QTextFormat::TabPositions | 0x1035 | タブの位置を指定します。タブの位置は、QTextOption::Tab の構造体であり、QList (内部的にはQList<QVariant>)に格納されます。 |
QTextFormat::BlockIndent | 0x1040 | |
QTextFormat::LineHeight | 0x1048 | |
QTextFormat::LineHeightType | 0x1049 | |
QTextFormat::BlockNonBreakableLines | 0x1050 | |
QTextFormat::BlockTrailingHorizontalRulerWidth | 0x1060 | 水平ルーラー要素の幅。 |
QTextFormat::HeadingLevel | 0x1070 | 見出しのレベル。例えば、1はHTMLのH1タグに対応し、それ以外は0となります。この列挙型値はQt 5.12で追加されました。 |
QTextFormat::BlockCodeFence | 0x1091 | Markdown コードブロックの周囲の「フェンス」に使用された文字。コードブロックがフェンスではなくインデントされている場合、このブロックにはこのプロパティは存在しないはずです。この列挙型値は Qt 5.14 で追加されました。 |
QTextFormat::BlockQuoteLevel | 0x1080 | このブロックにおけるネストされた引用符の深さ。1 は、そのブロックが最上位のブロック引用であることを意味します。ブロック引用ではないブロックには、このプロパティがあってはなりません。この列挙値は Qt 5.14 で追加されました。 |
QTextFormat::BlockCodeLanguage | 0x1090 | プレフォーマットされたブロックまたはコードブロック内のプログラミング言語。コードを含まないブロックには、このプロパティは存在してはなりません。この列挙型値は Qt 5.14 で追加されました。 |
QTextFormat::BlockMarker | 0x10A0 | ブロックの横に表示されるtype of adornment 。この列挙型値は Qt 5.14 で追加されました。 |
文字プロパティ
| 定数 | 値 | 説明 |
|---|---|---|
QTextFormat::FontFamily | 0x2000 | e{このプロパティは非推奨となっています。} 代わりに QTextFormat::FontFamilies を使用してください。 |
QTextFormat::FontFamilies | 0x1FE7 | |
QTextFormat::FontStyleName | 0x1FE8 | |
QTextFormat::FontPointSize | 0x2001 | |
QTextFormat::FontPixelSize | 0x2009 | |
QTextFormat::FontSizeAdjustment | 0x2002 | FontPointSize またはFontPixelSize を使用して設定された基本フォントサイズに加算される整数の調整値を指定します。 |
QTextFormat::FontFixedPitch | 0x2008 | |
QTextFormat::FontWeight | 0x2003 | |
QTextFormat::FontItalic | 0x2004 | |
QTextFormat::FontUnderline | 0x2005 | このプロパティは非推奨となりました。代わりに QTextFormat::TextUnderlineStyle を使用してください。 |
QTextFormat::FontOverline | 0x2006 | |
QTextFormat::FontStrikeOut | 0x2007 | |
QTextFormat::FontCapitalization | FirstFontProperty | テキストに適用する大文字化のタイプを指定します。 |
QTextFormat::FontLetterSpacingType | 0x1FE9 | FontLetterSpacing プロパティの意味を指定します。デフォルトはQFont::PercentageSpacing です。 |
QTextFormat::FontLetterSpacing | 0x1FE1 | フォント内の個々の文字間のデフォルトの間隔を変更します。値は、FontLetterSpacingType に応じて、パーセンテージまたは絶対値で指定されます。デフォルト値は 100% です。 |
QTextFormat::FontWordSpacing | 0x1FE2 | 単語間のデフォルトの間隔を変更します。正の値は単語間隔をその値に相当するピクセル分広げ、負の値は間隔を狭めます。 |
QTextFormat::FontStretch | 0x1FEA | QFont::Stretch プロパティに対応します |
QTextFormat::FontStyleHint | 0x1FE3 | QFont::StyleHint プロパティに対応します |
QTextFormat::FontStyleStrategy | 0x1FE4 | QFont::StyleStrategy プロパティに対応します |
QTextFormat::FontKerning | 0x1FE5 | フォントのカーニングが有効になっているかどうかを指定します。 |
QTextFormat::FontHintingPreference | 0x1FE6 | QFont::HintingPreference 列挙型の値に基づいて、ヒンティングの使用を制御します。 |
QTextFormat::FontFeatures | 0x2010 | [6.11 以降] 組版機能に整数を割り当てます。詳細については、QFont::setFeature() を参照してください。 |
QTextFormat::FontVariableAxes | 0x2011 | [6.11 以降] 可変フォントの可変軸に浮動小数点数を割り当てます。詳細については、QFont::setVariableAxis() を参照してください。 |
QTextFormat::TextUnderlineColor | 0x2020 | 下線、上線、および取り消し線を引く際の色を指定します。 |
QTextFormat::TextVerticalAlignment | 0x2021 | QTextCharFormat::VerticalAlignment 列挙型の値に基づいて、テキストの垂直方向の配置タイプを指定します。 |
QTextFormat::TextOutline | 0x2022 | テキストのアウトラインを描画するために使用するQPen を指定します。 |
QTextFormat::TextUnderlineStyle | 0x2023 | QTextCharFormat::UnderlineStyle 列挙型の値に基づいて、テキストの下線のスタイルを指定します。 |
QTextFormat::TextToolTip | 0x2024 | テキストの一部に対して表示される(オプションの)ツールチップを指定します。 |
QTextFormat::TextSuperScriptBaseline | 0x2025 | 上付きテキストのベースライン(高さの%単位)を指定します。 |
QTextFormat::TextSubScriptBaseline | 0x2026 | 下付きテキストのベースライン(高さの%単位)を指定します。 |
QTextFormat::TextBaselineOffset | 0x2027 | テキストのベースライン(高さの%単位)を指定します。正の値はテキストを対応する%分だけ上に移動させ、負の値は下に移動させます。 |
QTextFormat::IsAnchor | 0x2030 | |
QTextFormat::AnchorHref | 0x2031 | |
QTextFormat::AnchorName | 0x2032 | |
QTextFormat::ObjectType | 0x2f00 |
リストのプロパティ
| 定数 | 値 | 説明 |
|---|---|---|
QTextFormat::ListStyle | 0x3000 | リストの項目に使用されるスタイルを指定します。これは、QTextListFormat::Style 列挙型の値によって定義されます。 |
QTextFormat::ListIndent | 0x3001 | リストに適用されるインデントの量を指定します。 |
QTextFormat::ListNumberPrefix | 0x3002 | 番号付きリストの項目番号の前に付加されるテキストを定義します。 |
QTextFormat::ListNumberSuffix | 0x3003 | 番号付きリストの項目番号の末尾に付加されるテキストを定義します。 |
QTextFormat::ListStart (since Qt 6.6) | 0x3004 | リストの最初の値を定義します。 |
テーブルおよびフレームのプロパティ
| 定数 | 値 | 説明 |
|---|---|---|
QTextFormat::FrameBorder | 0x4000 | |
QTextFormat::FrameBorderBrush | 0x4009 | |
QTextFormat::FrameBorderStyle | 0x4010 | 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 | QTextTableFormat::borderCollapse プロパティを指定します。 |
表セルのプロパティ
| 定数 | 値 |
|---|---|
QTextFormat::TableCellRowSpan | 0x4810 |
QTextFormat::TableCellColumnSpan | 0x4811 |
QTextFormat::TableCellLeftPadding | 0x4814 |
QTextFormat::TableCellRightPadding | 0x4815 |
QTextFormat::TableCellTopPadding | 0x4812 |
QTextFormat::TableCellBottomPadding | 0x4813 |
QTextTableFormat::borderCollapse が有効な場合に使用することを想定したテーブルセルのプロパティ
| 定数 | 値 |
|---|---|
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 |
画像のプロパティ
| 定数 | 値 | 説明 |
|---|---|---|
QTextFormat::ImageName | 0x5000 | 画像のファイル名またはソース。 |
QTextFormat::ImageTitle | 0x5001 | HTML の image タグの title 属性、または Markdown 画像リンクにおける URL の後に続く引用符で囲まれた文字列。この列挙型値は Qt 5.14 で追加されました。 |
QTextFormat::ImageAltText | 0x5002 | HTMLのimageタグのalt属性、またはMarkdownの画像リンク内の画像の説明。この列挙型値はQt 5.14で追加されました。 |
QTextFormat::ImageWidth | 0x5010 | |
QTextFormat::ImageHeight | 0x5011 | |
QTextFormat::ImageQuality | 0x5014 | |
QTextFormat::ImageMaxWidth | 0x5015 | この列挙型値は、Qt 6.8で追加されました。 |
選択プロパティ
| 定数 | 値 | 説明 |
|---|---|---|
QTextFormat::FullWidthSelection | 0x06000 | 選択範囲の characterFormat に設定すると、テキストの全幅が選択された状態として表示されます。 |
改ページのプロパティ
| 定数 | 値 | 説明 |
|---|---|---|
QTextFormat::PageBreakPolicy | 0x7000 | ページの区切り方法を指定します。PageBreakFlag 列挙型を参照してください。 |
QTextFormat::UserProperty | 0x100000 |
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.