The QR Code Widget
Encodes a string as a QR code image. The QR code updates reactively when the input string changes.
Interface
val qr_code: fn(
?#cell_size: &[f64, null],
&string
) -> Widget
Parameters
#cell_size– Size in pixels of each cell in the QR code matrix, ornullfor the default size. Larger values produce a bigger QR code image.- positional
&string– The data to encode. Any valid string will be encoded into the QR code.
Examples
QR Code from Text Input
use gui;
use gui::text;
use gui::text_input;
use gui::qr_code;
use gui::column;
mod icon;
let url = "https://graphix-lang.github.io/graphix";
let col = column(
#spacing: &20.0,
#padding: &`All(30.0),
#halign: &`Center,
#width: &`Fill,
&[
text(#size: &24.0, &"QR Code Demo"),
text_input(
#placeholder: &"Enter text...",
#on_input: |v| url <- v,
&url
),
qr_code(#cell_size: &4.0, &url)
]
);
[&window(#icon: &icon::icon, #title: &"QR Code", &col)]
