简体   繁体   English

Qt安装程序框架-如何自定义?

[英]Qt Installer Framework - How to customise?

I've managed to successfully create an 'AdminProgram' which is used to build the installer for my main project. 我设法成功创建了一个“ AdminProgram”,该程序用于为我的主项目构建安装程序。 It creates required configs/packages in file system correctly, updates all .xml files and copies all required elements into the correct places before building the installer, which is pretty great. 它会在文件系统中正确创建所需的配置/软件包,更新所有.xml文件并将所有必需的元素复制到正确的位置,然后再构建安装程序,这非常好。

However, I am now looking to customize my installer to do a little more so that it is able to install a few drivers into the windows registry and at a later date remove existing installs before proceeding with a new one. 但是,我现在希望自定义安装程序以执行更多操作,以便它能够在Windows注册表中安装一些驱动程序,并在以后重新安装现有驱动程序之前,先删除现有安装程序。 I have studied the 'instructions' ( http://doc-snapshot.qt-project.org/qtifw-1.4/scripting.html#predefined-variables ) for some time now and have been unable to quite grasp how exactly these Custom Operations are implemented (where the example code is supposed to be written, how the overridden operations are accessed etc.). 我已经研究了“指令”( http://doc-snapshot.qt-project.org/qtifw-1.4/scripting.html#predefined-variables )已有一段时间了,并且无法完全掌握这些自定义操作的精确度实现(应该在其中编写示例代码,如何访问被覆盖的操作等)。

I find that the instruction are a little ambiguous for a programmer as inexperienced as myself and would very much appreciate some help from anyone who can give it? 我发现该指令对于像我这样没有经验的程序员来说有点模棱两可,并且会非常感谢能提供此指令的任何人的帮助吗?

In order to set entries in the registry you need to add GlobalConfig operations in your component script. 为了在注册表中设置条目,您需要在组件脚本中添加GlobalConfig操作。

Overload the method Component.prototype.createOperations and add additional commands such as: 重载方法Component.prototype.createOperations并添加其他命令,例如:

function Component() {
  'use strict';  
}

Component.prototype.createOperations = function () {
  'use strict';
  // call default implementation
  component.createOperations();

  component.addOperation("GlobalConfig",
            "HKEY_CURRENT_USER\\Software\\@Publisher@\\@ProductName@\\entry", 
            "key", 
            "value");
  }

The list of operations available are here 可用的操作列表在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM