如何在Qt安装程序(1.5.0)中进行文件关联? [英] How can I make file association in Qt installer(1.5.0)?

查看:275
本文介绍了如何在Qt安装程序(1.5.0)中进行文件关联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Windows的Qt安装程序框架(1.5.0)中建立文件关联?我想这样做:

How can I make file association in Qt installer framework(1.5.0) on Windows? I want to do this:

例如,当我双击myFile.x时,我的qt桌面应用程序(Windows)将启动并打开该文件。

For example, when I double click myFile.x then my qt desktop application(Windows) will launch and open this file.

我想在installscript.qs中更正此错误:

I want to correct this in installscript.qs :

component.addOperation("CreateShortcut", "@TargetDir@/A.exe", "@StartMenuDir@/A.lnk");
component.addOperation("RegisterFileType", 
                       "fl", 
                       "@TargetDir@\\A.exe" + "'%1'", 
                       "myFiles", 
                       "text/plain",
                       "@TargetDir@/A_icon.ico", 
                       "ProgId=A.fl");
component.addOperation("CreateShortcut", "@TargetDir@/uninstall.exe", "@StartMenuDir@/Uninstall.lnk");

当我写这个字符串时,它给出了解析错误。
输出为:
捕获的异常:加载组件脚本时发生异常:'D:/Workspace/A/A_installer/A/packages/com.ge.mss/meta/installscript.qs

When I write this string, it gives parse error. Output is : Caught exception: Exception while loading component script: 'D:/Workspace/A/A_installer/A/packages/com.ge.mss/meta/installscript.qs

语法错误:解析错误

回溯:
()@D:/ Workspace / A / A_installer / A / packages /com.ge.mss/meta/installscript.qs:102'

Backtrace: ()@D:/Workspace/A/A_installer/A/packages/com.ge.mss/meta/installscript.qs:102'

推荐答案

如果您使用的是Windows,请按照以下步骤操作:

If you are using windows just follow this:

component.addOperation("RegisterFileType",
                       "bob",
                       "@TargetDir@\\BobiSoft.exe \" %1\"",
                       "BobiSoft Files",
                       "application/x-binary",
                       "@TargetDir@/bobi_file_icon.ico",
                       "ProgId=BobiSoft.bob"); 

我也遇到这个问题,诀窍是替换'%1正如许多示例所说,使用 \%1\

I also had this problem, the trick was to replace the ' %1' as many examples say, with \" %1\".

这篇关于如何在Qt安装程序(1.5.0)中进行文件关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆