← Back to list

Building QRForge PRO with PySide6 — Beginner-Friendly Guide (Medium Version)

This article walks you through QRForge PRO v2.0.0, a professional QR code design and export studio, step by step. Perfect for Medium…

Mate Technologies · 2026-01-16 06:06 · 0 claps · 2.3 min read
#python #pyside6 #gui-development #qr-code #open-source
Open on Medium ↗
Wiki topics: 🔓 · Open Source

Building QRForge PRO with PySide6 — Beginner-Friendly Guide (Medium Version)

This article walks you through QRForge PRO v2.0.0, a professional QR code design and export studio, step by step. Perfect for Medium readers who want to learn PySide6, graphics programming, and QR code generation.

Introduction

QRForge PRO allows you to:

  • Generate QR codes from Text, URLs, and Wi‑Fi credentials
  • Customize colors, backgrounds, and transparency
  • Move, rotate, and scale QRs interactively
  • Export print-ready PNG, SVG, and PDF files

Technologies used:

  • Python 🐍
  • PySide6 (Qt for Python) 🖼
  • qrcode + Pillow 🔳
  • Requests for URL shortening 🌐

Full source code: QRForge PRO GitHub

Step 1: Project Setup

Install dependencies:

pip install PySide6 qrcode pillow requests

Project structure:

qrforge/

├─ main.py

├─ logo.ico

Step 2: Import Modules

import sys, os, math, requests

import qrcode

from PIL import Image

Qt imports for widgets, graphics, SVG, and PDF:

from PySide6.QtWidgets import *

from PySide6.QtGui import *

from PySide6.QtCore import *

from PySide6.QtSvg import QSvgGenerator

from PySide6.QtGui import QPdfWriter, QPageSize

Step 3: Metadata & Themes

APP_NAME = “QRForge PRO”

APP_VERSION = “2.0.0”

APP_AUTHOR = “Mate Technologies”

APP_URL = “https://matetools.gumroad.com"

Themes (dark/light) help style the UI:

DARK = {…}

LIGHT = {…}

Step 4: Utility Functions

Resource loader for PyInstaller:

def resource_path(name):

base = getattr(sys, “_MEIPASS”, os.path.dirname(file))

return os.path.join(base, name)

URL shortener using TinyURL API:

def shorten_url(url):

try:

r = requests.get(f”https://tinyurl.com/api-create.php?url={url}", timeout=5)

return r.text if r.status_code == 200 else url

except:

return url

Wi‑Fi QR payload:

def wifi_payload(ssid, pwd, enc):

return f”WIFI:S:{ssid};T:{enc if enc!=’NONE’ else ‘’};P:{pwd};;”

Step 5: QR Graphics Item

Create a QGraphicsItem for QR codes for drag, rotate, and selection:

class QRItem(QGraphicsItem):

def init(self, data):

super().init()

self.data = data

self.size = 300

self.rotation_angle = 0

self.fill = QColor(“black”)

self.bg = QColor(“white”)

self.transparent = False

self.generate()

Generate QR using qrcode and convert to QImage:

def generate(self):

qr = qrcode.QRCode(border=1)

qr.add_data(self.data)

qr.make(fit=True)

back = None if self.transparent else self.bg.name()

img = qr.make_image(fill_color=self.fill.name(), back_color=back).convert(“RGBA”)

self.qimage = QImage(img.tobytes(“raw”, “RGBA”), img.width, img.height, QImage.Format_RGBA8888)

Painting with optional selection outline:

def paint(self, p, *_):

p.save()

p.rotate(self.rotation_angle)

p.drawImage(self.boundingRect(), self.qimage)

p.restore()

if self.isSelected():

p.setPen(QPen(QColor(“#00E676”), 2, Qt.DashLine))

p.drawRect(self.boundingRect())

Step 6: Interactive Canvas

class Canvas(QGraphicsView):

def wheelEvent(self, e):

self.scale(1.15 if e.angleDelta().y() > 0 else 0.85,

1.15 if e.angleDelta().y() > 0 else 0.85)

Enable rotation with ALT + drag:

def mouseMoveEvent(self, e):

if self.rotating:

item = self.itemAt(e.position().toPoint())

if isinstance(item, QRItem):

dx = e.scenePosition().x() — item.scenePos().x()

dy = e.scenePosition().y() — item.scenePos().y()

item.rotation_angle = math.degrees(math.atan2(dy, dx))

item.update()

Step 7: Main Application Window

class QRForgeStudio(QMainWindow):

def init(self):

super().init()

self.scene = QGraphicsScene(-5000, -5000, 10000, 10000)

self.canvas = Canvas(self.scene)

self.setCentralWidget(self.canvas)

Add dock widgets for QR controls, color selection, and content input.

Step 8: Adding QR Codes

def add_qr(self):

mode = self.mode.currentText()

if mode == “Text”:

data = self.text.toPlainText()

elif mode == “URL”:

data = shorten_url(self.text.toPlainText())

else:

data = wifi_payload(self.ssid.text(), self.pwd.text(), self.enc.currentText())

item = QRItem(data)

self.scene.addItem(item)

item.setPos(0, 0)

Step 9: Export Options

  • PNG: Raster export
  • SVG: Vector export
  • PDF: Print-ready pages

Example: PNG export

img = QImage(width, height, QImage.Format_ARGB32)

self.scene.render(painter)

img.save(path)

Step 10: Running the App

if name == “main”:

app = QApplication(sys.argv)

win = QRForgeStudio()

win.show()

sys.exit(app.exec())

Conclusion

You now have a fully functional QR design studio with:

  • Interactive graphics
  • Color & transparency controls
  • Multi-format export

Next steps:

  • Add templates & logos
  • Batch generation
  • PyInstaller packaging for Windows/macOS/Linux

Happy coding! 🚀


메타데이터
post_id
bebf79a189cc
slug
building-qrforge-pro-with-pyside6-beginner-friendly-guide-medium-version-bebf79a189cc
url
https://medium.com/@mate-technologies/building-qrforge-pro-with-pyside6-beginner-friendly-guide-medium-version-bebf79a189cc
canonical_url
https://medium.com/@mate-technologies/building-qrforge-pro-with-pyside6-beginner-friendly-guide-medium-version-bebf79a189cc
author_url
https://medium.com/@mate-technologies
status
ok
fetched_at
2026-06-20 20:29:01