Using data
Data declares a data source. It renders no UI; it only fetches/reads data for bindings and scripts.
Basic form
The four types
Json
The response body is parsed as JSON, giving an object/array:Text
The response body is returned as a plain string:Xml
Parsed into a bindable tree:Binary
Yields:Url is a Blob URL and can be passed straight to Image / Media:
Online and local
Online:- Only https:443 is allowed;
- Requests go through the launcher backend proxy, redirects are forbidden, and loopback/intranet/reserved addresses are rejected;
- Text/JSON/XML limit 1MB, binary limit 8MB;
- Domains must be checked and confirmed in the editor.
- Absolute paths are used as-is;
- Relative paths: for locally imported widgets they resolve against the directory of the
.qwidget; for URL-imported widgets they resolve against the launcher data directory; - The editor information panel shows the resolved absolute path.
Cache and refresh
- Non-binary results are cached in localStorage per
Refresh; on remount an unexpired value is used directly. - Binary results are cached in memory only, so base64 does not blow up local storage.
Refresh="0"re-reads/refetches on every mount.- Manual refresh: the
Refreshbutton action refetches all expired data sources of this widget.
Binding multiple data sources
EachData has its own Name:
- Named sources are also directly reachable as
{News.*}/{Weather.*}. - Fields of unnamed sources (default name
Data) are merged into{Data.*}. - At most 8 data sources.
State
State.Loading is true while any data source is loading; State.Error is true when at least one data source failed.
Limits
- At most 8 data sources; total data cache per widget 2MB.
- Online request timeout 15 seconds (frontend request 20 seconds).
- Binary object URLs are released when the widget unmounts.