基于QML开发的二维码生成的QML插件

QRCode Powered QML Module

Designing cool, interactive interfaces. DuoDuoZhijiao came up with a much better answer for QRencode: QML, a declarative language perfect for designing UIs (and much more). Here's a sample of how QREncode Plugin For QML looks like:

Add LogoNo Logo

import QtQuick 2.3
import com.duoduo.component 1.0
    QREnCode{
        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: QREnCode.MODE_8    //encode model
		qrLevel: QREnCode.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)
        }
    }

This project aims at bringing the power of qrencode to qml designer UI.

Summary

How to Build

Add the source code to your local machine on Mac Windows Linux.
Make Sure Setting your env for Qt SDK
Use Command

Git clone it.

make clean(mingw32-make clean)
qmake
make (mingw32-make mingw) | nmake(vc)
sudo make install (*unix)

Use QtCreator

You may use qtcreator to build it.

How to use with QREnCode

Note that for the following, you need to have Qt SDK for Qt5.x or later installed.

QREnCode

You can use QREnCode to encode your qrencode UI.

import QtQuick 2.3
import com.duoduo.component 1.0
    QREnCode{
        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: QREnCode.MODE_8    //encode model
		qrLevel: QREnCode.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)
        }
    }	
	//use this function also can save current item to file
	 function savetofile(obj,filename){
        obj.grabToImage(function(result) {
      result.saveToFile(filename);
    });
    }
Implemented QML Extension USE C++ (QQmlExtensionPlugin)

Implemented a QML Extension module that:

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

Above all signals

Implemented slots and functions

-all Above slots -setQrSaveFile(const QString& filePath) //can sava current qrencode to file

FeedBack

contact information

Email(373955953#qq.com, Change#to@) QQ: 39559539234 QQ Group:312125701 github: 寒山-居士

Thanks

https://github.com/penk/terrarium-app

About Author

var duoduozhijiao = { nickName : "寒山-居士", site : "http://www.heilqt.com", blog : "http://blog.heilqt.com" }

转载于:https://my.oschina.net/yiyidaishui/blog/525532

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
基于QML(Qt Meta-Object Language)的监控系统开发具有许多优势。QML是一种声明式的语言,用于创建可交互的用户界面,并且与C++结合使用,使得开发高度可定制的监控系统变得更加简单和高效。 首先,QML提供了一种直观且易于理解的方式来设计用户界面。通过使用QML开发人员可以轻松创建动态和交互式的监控系统,以满足用户的需求。使用QML的强大功能,可以通过简单的代码编写来处理用户交互和数据显示。 其次,QML具有良好的可扩展性。QML是基于Qt框架的,这使得可以在不同的平台上运行开发的监控系统。无论是在Windows、Mac还是Linux系统上,基于QML的监控系统都能够正常运行,这大大增加了其适用范围。 此外,基于QML的监控系统可以与C++代码进行无缝集成。开发人员可以使用C++编写高性能的后台逻辑,然后通过使用QML将其连接到用户界面。这样一来,开发人员可以充分利用C++的强大功能,同时使用QML的灵活性和直观性。 最后,基于QML的监控系统可以轻松应对不同设备的屏幕尺寸和分辨率。QML允许开发人员在界面设计中使用自适应布局和可缩放的图形元素,以确保监控系统在不同设备上的显示效果良好。 综上所述,基于QML的监控系统开发是一种强大而灵活的选择。它提供了直观的用户界面设计,良好的可扩展性,与C++的无缝集成以及对不同设备的适应性,这些都使得开发高质量的监控系统变得更加容易。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值