QT实现二维码扫码

QT实现二维码扫码QT实现二维码扫码QT实现二维码扫码

应用介绍

//QML2 code
import QtQuick 2.3
import com.duoduo.component 1.0
    QtQuick2QREncode{
        id:qr
        width: 128
        height: 128
        qrSize: Qt.size(width,width)
        anchors.centerIn: parent
        qrData:"duoduozhijiao" //encode contents
        qrForeground: "#29aee1" //encode color
        qrBackground: "white"
        qrMargin: 2
        qrMode: QtQuick1QREncode.MODE_8    //encode model
		qrLevel: QtQuick1QREncode.LEVEL_Q // encode level
        qrLogo: "qrc:/256.png" //or local path or qrc path but not network url
        onQrSaveFileChanged: {
            console.log("We get save file path is :"+qrfilepath)
        }
    }
//qml1 Code:
import QtQuick 1.0 //notice here
import com.ddui.qmlcomponents 1.0

Item {
    width: 256
    height: width
    visible: true
    QtQuick1QREncode{
           id:qr
           anchors.fill: parent
           qrSize: Qt.size(width,width)
           qrData:"www.heilqt.com" //encode contents
           qrForeground: "#29aee1" //encode color
           qrBackground: "white"
           qrMargin: 4
           qrMode: QtQuick1QREncode.MODE_8    //encode model
           qrLevel: QtQuick1QREncode.LEVEL_Q // encode level
           qrLogo: "qrc:/Apple.png" //or local path or qrc path but not network url
           onQrSaveFileChanged: {
               console.log("We get save file path is :"+qrfilepath)
           }
           onQrSizeChanged:{
               console.log("Size get save file path is :"+qrsize.width)
           }
       }
    onWidthChanged: {
        if(width>height){
            qr.setQrSize(Qt.size(height,height))
        }else{
            qr.setQrSize(Qt.size(width,width))
        }
    }
}

//this is a widgets Code
//this is a widgets Code
#include <QApplication>
#include "dduiqrwidgets.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    DDuiQRWidgets w;
    w.resize(400,100);
    w.show();
    w.setQrSaveFile("xxx.png");
    return app.exec();
}

用到得属性:

  • qrData (QtQuick1QREncode data show)
  • qrLogo (QtQuick1QREncode middle logo)
  • qrSize (QtQuick1QREncode size)
  • qrMode (mode )
  • qrLevel (level )
  • qrCasesen (casesen upper)
  • qrMargin (margin)
  • qrPercent (percent)
  • qrForeground (qrForeground)
  • qrBackground (qrBackground)

文件列表(部分)

名称 大小 修改日期
qtquickqrencode-master0.00 KB2020-05-30
README.md5.16 KB2018-04-58
example0.00 KB2018-04-58
qml1test0.00 KB2018-04-58
Apple.png4.78 KB2018-04-58
deployment.pri0.25 KB2018-04-58
main.cpp0.32 KB2018-04-58
main.qml0.98 KB2018-04-58
qml.qrc0.12 KB2018-04-58
qml1test.pro0.30 KB2018-04-58
qml2test0.00 KB2018-04-58
AliasText.qml0.33 KB2018-04-58
deployment.pri0.25 KB2018-04-58
main.cpp0.24 KB2018-04-58
main.qml1.35 KB2018-04-58
qml.qrc0.12 KB2018-04-58
qml2test.pro0.29 KB2018-04-58
widgetstest0.00 KB2018-04-58
main.cpp0.23 KB2018-04-58
widgetstest.pro0.23 KB2018-04-58
xxx.png1.71 KB2018-04-58
include0.00 KB2018-04-58
dduiqrwidgets.h3.83 KB2018-04-58
qrencode0.00 KB2018-04-58
3rd0.00 KB2018-04-58
bitstream.h1.40 KB2018-04-58
config.h2.64 KB2018-04-58
mask.h1.52 KB2018-04-58
mmask.h1.37 KB2018-04-58
mqrspec.h4.66 KB2018-04-58
qrencode.h20.43 KB2018-04-58
qrencode_inner.h2.71 KB2018-04-58

立即下载

相关下载

[QT实现二维码扫码] QT实现二维码扫码QT实现二维码扫码QT实现二维码扫码

评论列表 共有 0 条评论

暂无评论

微信捐赠

微信扫一扫体验

立即
上传
发表
评论
返回
顶部