通常:我需要一个bool或其他钩子来确定是否已选择安装组件,以便我的controlscript.qs(或特定于组件的installscript.qs)可以采取适当的操作。
具体来说:Qt安装程序框架有几个默认页面供用户点击。在Windows上有一个StartMenuSelection页面,允许用户在Windows“开始”菜单中指定应用程序的快捷方式应该进入的组(如果有)。
Start Menu group selection example
我要安装的组件之一是“开始”菜单中的(可选)快捷方式。如果未选择安装,则开始菜单中将没有已安装应用程序的快捷方式。
我的问题是,无论用户是否在“开始”菜单中要求快捷方式,都会显示“开始菜单”组选择页面。我知道在所有情况下如何摆脱它。但不是有条件地确定是否实际安装了“开始”菜单快捷方式。
我有一个控制脚本,包含以下内容:
function Controller()
{
}
Controller.prototype.StartMenuDirectoryPageCallback = function()
{
// Get the current wizard page
var widget = gui.currentPageWidget();
if (widget != null) {
var component = installer.componentByName("startmenu"); // startmenu is the component name
//if (!component.isSelected){
//if (!component.isSelectedForInstallation){
if (!component.isInstalled){
// I only want this hidden if the user didn't want a start menu link
// Either of the below commands will skip the startMenuSelection page
installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);
//gui.clickButton(buttons.NextButton);
}
}
}
但这不起作用。 component.isSelected和component.isSelectedForInstallation始终返回false,而component.isInstalled始终返回true,无论是否实际选择了该组件进行安装。也许这些是错误的布尔人要问的?
或者这可能是错误的做法?基本上,我只需要一个钩子来确定是否选择了一个组件。
他们在这里使用:
component.installed
isInstalled
是一个函数(http://doc.qt.io/qtinstallerframework/scripting-component.html#isInstalled-method),这就是为什么它总是会返回true。所以component.isInstalled()
可能也会起作用......
要么,installationRequested()
将是另一种使用的可能性。这可能是在实际安装之前设置的。