Qt Quick 텍스트 입력 처리 및 유효성 검사기
텍스트 시각적 유형
Qt Quick 은 화면에 텍스트를 표시하는 여러 유형을 제공합니다. Text 유형은 서식이 지정된 텍스트를 화면에 표시하고, TextEdit 유형은 여러 줄의 줄 편집을 화면에 표시하며, TextInput 유형은 편집 가능한 단일 줄 필드를 화면에 표시합니다.
특정 기능 및 속성에 대해 자세히 알아보려면 해당 문서를 참조하세요.
입력 텍스트 유효성 검사
유효성 검사기 유형은 TextInput 객체의 유형과 형식을 강제합니다.
정수가 아닌 숫자에 대한 유효성 검사기를 정의합니다. | |
정수 값에 대한 유효성 검사기를 정의합니다. | |
문자열 유효성 검사기를 제공합니다. |
Column { spacing: 10 Text { text: "Enter a value from 0 to 2000" } TextInput { focus: true validator: IntValidator { bottom:0; top: 2000} } }
유효성 검사기 유형은 TextInput
의 validator
속성에 바인딩됩니다.
Column { spacing: 10 Text { text: "Which basket?" } TextInput { focus: true validator: RegularExpressionValidator { regularExpression: /fruit basket/ } } }
스니펫의 정규식은 입력된 텍스트가 fruit basket
로만 허용합니다.
QML은 JavaScript 정규 표현식을 구문 분석하는 반면, Qt의 QRegularExpression 클래스의 정규 표현식은 Perl 정규 표현식을 기반으로 한다는 점에 유의하세요.
© 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.