/* * This file is part of the 2FA Manager App for Ubuntu Touch * Copyright (C) 2019 Joan CiberSheep * * This App is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * * This App is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ import QtQuick 2.9 import "../js/qqr.js" as QRCodeBackend Canvas { id: canvas // background colour to be used property color background : "white" // foreground colour to be used property color foreground : "black" // ECC level to be applied (e.g. L, M, Q, H) property string level : "L" // value to be encoded in the generated QR code property string value : "" onPaint : { var qr = QRCodeBackend.get_qr() qr.canvas({ background : canvas.background, canvas : canvas, value: canvas.value, foreground : canvas.foreground, level : canvas.level, side : Math.min(canvas.width, canvas.height), value : canvas.value }) } onHeightChanged : { requestPaint() } onWidthChanged : { requestPaint() } onBackgroundChanged : { requestPaint() } onForegroundChanged : { requestPaint() } onLevelChanged : { requestPaint() } onValueChanged : { requestPaint() } }