Skip to main content

SideQR

SideQR is a PySide6-based library that provides a custom QML component for real-time QR code scanning. It leverages OpenCV and PyZbar for efficient QR code detection and can be seamlessly integrated into PySide6 applications using QML.


Features

  • Real-time QR code detection using the device camera
  • Multiple barcode detection with timestamp tracking
  • Customizable QML component (QRScanner) for easy integration
  • Real-time highlight overlays for detected QR codes
  • Visible barcodes model for tracking currently detected codes
  • Detection history logging
  • Adjustable debounce period for code persistence
  • Lightweight and fast, using multithreading for frame processing

Installation

You can install SideQR via pip:

pip install sideqr

Or install directly from the GitHub repository:
pip install git+https://github.com/vishnumg/SideQR.git


Usage
1. Basic Implementation
import QtQuick
import QtQuick.Controls
import QtMultimedia
import SideQR 1.0

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: "QR Code Scanner"

    MediaDevices { id: mediaDevices }

    CaptureSession {
        camera: Camera {
            id: camera
            cameraDevice: mediaDevices.defaultVideoInput
            active: true
        }
        videoOutput: qrScanner.videoSink
    }

    QRScanner {
        id: qrScanner
        previewOutput: videoOutput.videoSink
        
        onBarcodesDetected: barcodes => {
            // Handle new detections
            barcodes.forEach(barcode => console.log("Detected:", barcode.data))
        }
    }

    VideoOutput {
        id: videoOutput
        height: parent.height/2
    }

    Row {
        anchors.top: videoOutput.bottom
        spacing: 10

        // Visible Barcodes List
        Column {
            width: parent.width/2
            Text { 
                text: "Visible Barcodes" 
                font.bold: true
            }
            ListView {
                width: parent.width
                height: 150
                model: qrScanner.visibleBarcodesModel
                delegate: Text {
                    text: model.data + " - " + new Date(model.timestamp).toLocaleTimeString()
                }
            }
        }

        // Detection History
        Column {
            width: parent.width/2
            Text { 
                text: "Detection Log" 
                font.bold: true
            }
            ListView {
                width: parent.width
                height: 150
                model: ListModel { id: logsModel }
                delegate: Text {
                    text: model.data + " at " + model.timestamp
                }
            }
        }
    }
}

2. Advanced Features
Accessing Barcode Details:
ListView {
    model: qrScanner.visibleBarcodesModel
    delegate: Column {
        Text { text: "Data: " + model.data }
        Text { text: "Bounding Box: " + model.bbox }
        Text { text: "Timestamp: " + new Date(model.timestamp).toLocaleTimeString() }
    }
}

Configuring Scanner Properties:
QRScanner {
    id: qrScanner
    highlightDetected: true  // Enable/disable visual highlights
    debouncePeriod: 2000     // Set persistence time in milliseconds
}


API
QRScanner Properties



Property
Type
Description




videoSink
QObject
Camera input connection (read-only)


previewOutput
QObject
Processed video output


highlightDetected
bool
Enable/disable detection highlights


debouncePeriod
int
Barcode persistence time in milliseconds


visibleBarcodesModel
QObject
List model of currently visible barcodes



QRScanner Signals

barcodesDetected(list<BarcodeResult>)
Emits when new barcodes are detected, containing:

data: Decoded text content
bbox: Bounding box coordinates (left, top, width, height)
timestamp: Detection timestamp




Dependencies

PySide6
OpenCV
PyZbar
NumPy

Install all dependencies with:
pip install PySide6 opencv-python pyzbar numpy


Contributing
Contributions are welcome! Please follow these steps:

Fork the repository
Create your feature branch: git checkout -b feature-name
Commit your changes: git commit -m 'Add new feature'
Push to the branch: git push origin feature-name
Open a pull request


License
This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for sideqr 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sideqr 0.0.2
File Size Uploaded
sideqr-0.0.2.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sideqr 0.0.2
File Interpreter ABI Platform
sideqr-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.8 kB

Release files / sideqr-0.0.2.tar.gz

Download URL sideqr-0.0.2.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6449364d7c0fb4fa0be0c803ffd645d454a77517e91b37fc40390c06743bc837
BLAKE2b-256 checksum
How to use checksums
c56e5f07dbd6bd318328ca32d7f4d032abb657e46372600f5aa4068e5ddf78f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / sideqr-0.0.2-py3-none-any.whl

Download URL sideqr-0.0.2-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f22af12fc7867b90ed54b04487eb8a763f94ffbf0b7bcbc2ca56c80e304ce114
BLAKE2b-256 checksum
How to use checksums
72041cb9c49d73774469ecab2093ba935918b4c7e37d7047509c5596bd0419f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page