# AtlasUrlValidator

> A validator for a text field that accepts a URL with one of a set of schemes.

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](https://atlasos.eterneon.net/framework/atlas-ui/atlas-text-field.md)) so the field says what is wrong.

Like the other Atlas validators ([AtlasEmailValidator](https://atlasos.eterneon.net/framework/atlas-ui/atlas-email-validator.md), [AtlasPathValidator](https://atlasos.eterneon.net/framework/atlas-ui/atlas-path-validator.md), [AtlasNumberValidator](https://atlasos.eterneon.net/framework/atlas-ui/atlas-number-validator.md)) 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

```qml
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.
