QTextListFormat Class
QTextListFormat 클래스는 QTextDocument 에 있는 목록에 대한 서식 정보를 제공합니다. 더 보기...
| 헤더: | #include <QTextListFormat> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
| qmake: | QT += gui |
| 상속: | QTextFormat |
- 상속된 멤버를 포함한 모든 멤버 목록
- QTextListFormat은 리치 텍스트 처리 API 및 암시적 공유 클래스의 일부입니다.
참고: 이 클래스의 모든 함수는 재진입 가능합니다.
공개 유형
| 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 ’를 설정합니다.
[since 6.6] int QTextListFormat::start() const
style()의 값이 QTextListFormat::ListDecimal 인 경우 첫 번째 목록 항목에 표시될 번호를 반환하거나, 다른 정렬된 목록 유형의 오프셋을 반환합니다.
이 함수는 Qt 6.6에서 도입되었습니다.
setStart()도 참조하십시오 .
QTextListFormat::Style QTextListFormat::style() const
목록 형식의 스타일을 반환합니다.
© 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.