【发布时间】:2018-07-15 22:30:06
【问题描述】:
通常:我需要一个 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,无论是否实际选择了组件进行安装。也许这些是错误的布尔值?
或者也许这是错误的方法?本质上,我只需要一个钩子来确定一个组件是否被选中。
【问题讨论】:
标签: qt