应用介绍
//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)
©版权声明:本文内容由互联网用户自发贡献,版权归原创作者所有,本站不拥有所有权,也不承担相关法律责任。如果您发现本站中有涉嫌抄袭的内容,欢迎发送邮件至: www_apollocode_net@163.com 进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。
转载请注明出处: apollocode » QT实现二维码扫码
文件列表(部分)
名称 | 大小 | 修改日期 |
---|---|---|
qtquickqrencode-master | 0.00 KB | 2020-05-30 |
README.md | 5.16 KB | 2018-04-58 |
example | 0.00 KB | 2018-04-58 |
qml1test | 0.00 KB | 2018-04-58 |
Apple.png | 4.78 KB | 2018-04-58 |
deployment.pri | 0.25 KB | 2018-04-58 |
main.cpp | 0.32 KB | 2018-04-58 |
main.qml | 0.98 KB | 2018-04-58 |
qml.qrc | 0.12 KB | 2018-04-58 |
qml1test.pro | 0.30 KB | 2018-04-58 |
qml2test | 0.00 KB | 2018-04-58 |
AliasText.qml | 0.33 KB | 2018-04-58 |
deployment.pri | 0.25 KB | 2018-04-58 |
main.cpp | 0.24 KB | 2018-04-58 |
main.qml | 1.35 KB | 2018-04-58 |
qml.qrc | 0.12 KB | 2018-04-58 |
qml2test.pro | 0.29 KB | 2018-04-58 |
widgetstest | 0.00 KB | 2018-04-58 |
main.cpp | 0.23 KB | 2018-04-58 |
widgetstest.pro | 0.23 KB | 2018-04-58 |
xxx.png | 1.71 KB | 2018-04-58 |
include | 0.00 KB | 2018-04-58 |
dduiqrwidgets.h | 3.83 KB | 2018-04-58 |
qrencode | 0.00 KB | 2018-04-58 |
3rd | 0.00 KB | 2018-04-58 |
bitstream.h | 1.40 KB | 2018-04-58 |
config.h | 2.64 KB | 2018-04-58 |
mask.h | 1.52 KB | 2018-04-58 |
mmask.h | 1.37 KB | 2018-04-58 |
mqrspec.h | 4.66 KB | 2018-04-58 |
qrencode.h | 20.43 KB | 2018-04-58 |
qrencode_inner.h | 2.71 KB | 2018-04-58 |
发表评论 取消回复