Qt開發打字動效軟件
看到vs有炫酷的打字動效插件,心癢難耐,自己也想用上,可自己用的是QtCreator,無奈之下,只好用Qt寫一個小軟件,實現打字動效
一、軟件設計
1.QueryKeyThread
類實現windows下光標位置識別和鍵盤按鍵識別
2.Widget
類實現加載qml
界面,並根據QueryKeyThread
識別,觸發界面通信
3.qml
界面使用粒子實現動效
4.效果
理論上能識別windows上所有編輯框,但是在部分編輯軟件中座標有點偏差
二、打包程序
三、發佈程序
爲了生成開始菜單和桌面快捷方式,要修改installscript.qs
文件
Component.prototype.createOperations = function()
{
// call default implementation to actually install README.txt!
component.createOperations();
if (systemInfo.productType === "windows") {
component.addOperation("CreateShortcut", "@TargetDir@/qmlDemoWinKeyKaTong.exe", "@StartMenuDir@/qmlDemoWinKeyKaTong.lnk",
"workingDirectory=@TargetDir@", "iconPath=@TargetDir@/qmlDemoWinKeyKaTong.exe",
"iconId=0", "description=@TargetDir@/qmlDemoWinKeyKaTong.exe");
component.addOperation("CreateShortcut", "@TargetDir@/qmlDemoWinKeyKaTong.exe", "@HomeDir@/Desktop/qmlDemoWinKeyKaTong.lnk",
"workingDirectory=@TargetDir@", "iconPath=@TargetDir@/qmlDemoWinKeyKaTong.exe",
"iconId=0", "description=@TargetDir@/qmlDemoWinKeyKaTong.exe");
}
}