QTextLength Class

QTextLengthクラスは、QTextDocument で使用されるさまざまなタイプの長さをカプセル化します

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

注意:このクラスの関数はすべてリエントラントです。

パブリック型

enum Type { VariableLength, FixedLength, PercentageLength }

パブリック関数

QTextLength()
QTextLength(QTextLength::Type type, qreal value)
qreal rawValue() const
QTextLength::Type type() const
qreal value(qreal maximumLength) const
QVariant operator QVariant() const
bool operator!=(const QTextLength &other) const
bool operator==(const QTextLength &other) const

詳細説明

テキスト文書内の要素の長さの値を指定するとき、その長さが期待した方法で使用されるように、しばしば他の情報を提供する必要があります。例えば、テーブルの幅を指定する場合、その値は固定ピクセル数を表すこともあれば、パーセンテージ値を表すこともあります。この情報によって、値の意味も使われ方も変わります。

一般に、このクラスは表の幅を指定するために使われます。固定ピクセル数、フレーム幅に対するパーセンテージ、可変幅のいずれかを指定することができます。

QTextTableも参照

メンバ型ドキュメント

enum QTextLength::Type

この列挙型は、長さオブジェクトが持ちうるさまざまな型を記述します。

定数説明
QTextLength::VariableLength0オブジェクトの幅が可変
QTextLength::FixedLength1オブジェクトの幅は固定
QTextLength::PercentageLength2オブジェクトの幅が最大幅に対するパーセンテージである。

type()も参照

メンバ関数ドキュメント

QTextLength::QTextLength()

可変のサイズを表す新しい length オブジェクトを構築する。

[explicit] QTextLength::QTextLength(QTextLength::Type type, qreal value)

与えられたtypevalue の新しい length オブジェクトを構築する。

qreal QTextLength::rawValue() const

長さのタイプに固有の制約値を返します。長さがQTextLength::PercentageLength の場合、生の値はパーセントで、0から100の範囲です。長さがQTextLength::FixedLength の場合、その固定値が返されます。可変長の場合は、ゼロが返されます。

QTextLength::Type QTextLength::type() const

この長さオブジェクトの型を返します。

QTextLength::Typeも参照してください

qreal QTextLength::value(qreal maximumLength) const

length オブジェクトの型と指定されたmaximumLength によって制約された実効長を返す。

type()も参照

QVariant QTextLength::operator QVariant() const

テキストの長さをQVariant

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

このテキスト長がother のテキスト長と異なる場合はtrue を返す。

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

こ のテ キ ス ト の長 さ がother のテ キ ス ト の長 さ と 同 じ な らtrue を返す。

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