From e54cf8a1bd70072fc7fedb26beca3d668056dd6f Mon Sep 17 00:00:00 2001 From: kieran Date: Sat, 11 Jan 2025 03:06:31 +0000 Subject: [PATCH] add readme --- Cargo.toml | 4 ++-- README.md | 10 ++++++++++ examples/main.rs | 2 +- src/lib.rs | 7 +------ 4 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 README.md diff --git a/Cargo.toml b/Cargo.toml index 4634732..bebfb8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -egui = { version = "0.29.1", default-features = false } +egui = { version = "0.29.0", default-features = false } qrcode = { version = "0.14.1", default-features = false } [dev-dependencies] -eframe = "0.29.1" \ No newline at end of file +eframe = "0.29.0" \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..d530a6c --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# egui_qr + +Simple egui painter that renders QR Codes + +## Example + +```rust +QrCodeWidget::from_data(b"https://google.com")? + .ui(ui); +``` \ No newline at end of file diff --git a/examples/main.rs b/examples/main.rs index 02c55cc..e48f78c 100644 --- a/examples/main.rs +++ b/examples/main.rs @@ -6,7 +6,7 @@ fn main() { let _ = eframe::run_native( "egui_qr", NativeOptions::default(), - Box::new(|_| Box::new(App::new())), + Box::new(|_| Ok(Box::new(App::new()))), ); } diff --git a/src/lib.rs b/src/lib.rs index 0374ca4..261aafd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,12 +40,7 @@ impl Widget for QrCodeWidget<'_> { let (response, painter) = ui.allocate_painter(vec2(w as f32 * scale, w as f32 * scale), Sense::click()); - painter.rect( - response.rect, - Rounding::ZERO, - Color32::WHITE, - Stroke::NONE, - ); + painter.rect(response.rect, Rounding::ZERO, Color32::WHITE, Stroke::NONE); let mut ctr = 0; for c in code_ref.to_colors() { let row = ctr / w;