AtlasUrlValidator
A validator for a text field that accepts a URL with one of a set of schemes.
Since 1.4.0
AtlasUrlValidator is a QValidator for a field's validator. Acceptable text is a complete URL whose scheme is in schemes; http and https also need a host. Pair it with AtlasTextField.invalidText (AtlasTextField) so the field says what is wrong.
Like the other Atlas validators (AtlasEmailValidator, AtlasPathValidator, AtlasNumberValidator) it rejects text over a fixed length, uses no regular expressions and rejects NUL and other control characters. Intermediate means the user can still type a valid URL.
Example
AtlasTextField {
validator: AtlasUrlValidator { schemes: ["https"] }
invalidText: qsTr("Enter a web address starting with https://")
}Properties
| Name | Type | Default | Description |
|---|---|---|---|
schemes |
list<string> |
["https"] |
The accepted URL schemes, without the colon, matched without regard to case. An empty list makes every non-empty text Invalid. |
Note
Acceptable text is still not safe to splice into a URL or header unencoded. Text with spaces around it is Intermediate until fixup() trims it. Text over 2048 characters is Invalid.