QTextListFormat Class

QTextListFormat 클래스는 QTextDocument.. . 더보기...

헤더: #include <QTextListFormat>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
상속합니다: QTextFormat

참고: 이 클래스의 모든 함수는 재인용됩니다.

공용 유형

enum Style { ListDisc, ListCircle, ListSquare, ListDecimal, ListLowerAlpha, …, ListUpperRoman }

공용 함수

QTextListFormat()
int indent() const
bool isValid() const
QString numberPrefix() const
QString numberSuffix() const
void setIndent(int indentation)
void setNumberPrefix(const QString &numberPrefix)
void setNumberSuffix(const QString &numberSuffix)
(since 6.6) void setStart(int start)
void setStyle(QTextListFormat::Style style)
(since 6.6) int start() const
QTextListFormat::Style style() const

상세 설명

목록은 텍스트 블록으로 표시되는 하나 이상의 항목으로 구성됩니다. 목록의 형식은 목록에 있는 항목의 모양을 지정합니다. 특히 각 항목의 들여쓰기와 스타일을 결정합니다.

항목의 들여쓰기는 각 항목이 왼쪽 여백에서 일정량만큼 오프셋되도록 하는 정수 값입니다. 이 값은 indent()로 읽고 setIndent()로 설정합니다.

각 항목을 꾸미는 데 사용되는 스타일은 setStyle()로 설정되며 style() 함수로 읽을 수 있습니다. 스타일은 목록의 항목에 사용되는 글머리 기호 유형과 번호 매기기 체계를 제어합니다. 십진수 번호 체계를 사용하는 목록은 setStart()를 통해 재정의하지 않는 한 0이 아닌 1부터 카운트가 시작된다는 점에 유의하세요.

스타일 속성을 설정하여 목록 항목의 모양을 추가로 구성할 수 있습니다. 예를 들어 ListNumberPrefix 및 ListNumberSuffix 속성을 사용하여 정렬된 목록에 사용되는 숫자가 (1), (2), (3) 등으로 표시되도록 사용자 지정할 수 있습니다:

QTextListFormat listFormat;

listFormat.setStyle(QTextListFormat::ListDecimal);
listFormat.setNumberPrefix("(");
listFormat.setNumberSuffix(")");

cursor.insertList(listFormat);

QTextList참조하세요 .

멤버 유형 문서

enum QTextListFormat::Style

이 열거형은 목록 항목을 장식하는 데 사용되는 기호를 설명합니다:

상수설명
QTextListFormat::ListDisc-1채워진 원
QTextListFormat::ListCircle-2빈 원
QTextListFormat::ListSquare-3채워진 사각형
QTextListFormat::ListDecimal-4오름차순으로 십진수 값
QTextListFormat::ListLowerAlpha-5알파벳 순서대로 라틴 소문자
QTextListFormat::ListUpperAlpha-6알파벳 순서로 라틴 대문자
QTextListFormat::ListLowerRoman-7소문자 로마 숫자(최대 4999개 항목만 지원)
QTextListFormat::ListUpperRoman-8대문자 로마 숫자(최대 4999개 항목만 지원)

멤버 기능 문서

QTextListFormat::QTextListFormat()

새 목록 형식 객체를 생성합니다.

int QTextListFormat::indent() const

목록 형식의 들여쓰기를 반환합니다. 들여쓰기에 QTextDocument::indentWidth 속성을 곱하여 픽셀 단위의 유효 들여쓰기를 얻습니다.

setIndent()도 참조하세요 .

bool QTextListFormat::isValid() const

이 목록 형식이 유효하면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

QString QTextListFormat::numberPrefix() const

목록 형식의 숫자 접두사를 반환합니다.

setNumberPrefix()도 참조하세요 .

QString QTextListFormat::numberSuffix() const

목록 형식의 숫자 접미사를 반환합니다.

setNumberSuffix()도 참조하세요 .

void QTextListFormat::setIndent(int indentation)

목록 형식의 indentation 을 설정합니다. 들여쓰기에 QTextDocument::indentWidth 속성을 곱하여 픽셀 단위의 유효 들여쓰기를 얻습니다.

indent()도 참조하세요 .

void QTextListFormat::setNumberPrefix(const QString &numberPrefix)

목록 형식의 숫자 접두사를 numberPrefix 에 지정된 문자열로 설정합니다. 모든 정렬된 목록 유형에 사용할 수 있습니다. 정렬되지 않은 목록 유형에는 영향을 미치지 않습니다.

기본 접두사는 빈 문자열입니다.

numberPrefix()도 참조하세요 .

void QTextListFormat::setNumberSuffix(const QString &numberSuffix)

목록 형식의 숫자 접미사를 numberSuffix 에 지정된 문자열로 설정합니다. 모든 정렬된 목록 유형에 사용할 수 있습니다. 정렬되지 않은 목록 유형에는 영향을 주지 않습니다.

기본 접미사는 "."입니다.

numberSuffix()도 참조하세요 .

[since 6.6] void QTextListFormat::setStart(int start)

목록 형식의 start 인덱스를 설정합니다.

이를 통해 1이 아닌 인덱스로 목록을 시작할 수 있습니다. 예를 들어 style()가 QTextListFormat::ListLowerAlpha 이고 start()가 4 인 경우 첫 번째 목록 항목이 "d"로 시작됩니다. 정렬되지 않은 목록 유형에는 영향을 미치지 않습니다.

기본 시작은 1 입니다.

이 함수는 Qt 6.6에 도입되었습니다.

start()도 참조하십시오 .

void QTextListFormat::setStyle(QTextListFormat::Style style)

목록 형식의 style 을 설정합니다.

style() 및 Style도 참조하세요 .

[since 6.6] int QTextListFormat::start() const

style()가 QTextListFormat::ListDecimal 인 경우 첫 번째 목록 항목에 표시할 번호를 반환하거나 다른 정렬된 목록 유형과 상쇄합니다.

이 함수는 Qt 6.6에 도입되었습니다.

setStart()도 참조하십시오 .

QTextListFormat::Style QTextListFormat::style() const

목록 형식의 스타일을 반환합니다.

setStyle() 및 Style도 참조하세요 .

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