Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Qt安装程序框架:如何检查是否选择组件进行安装_Qt_Qt Installer - Fatal编程技术网

Qt安装程序框架:如何检查是否选择组件进行安装

Qt安装程序框架:如何检查是否选择组件进行安装,qt,qt-installer,Qt,Qt Installer,关于Qt安装程序框架,我有一个问题: 如果当前在“组件选择”页面中选择安装此组件,如何签入组件脚本 没有组件属性,我找不到可以查询的值。您可以使用这些函数 component.componentChangeRequested(); component.installationRequested(); component.updateRequested(); component.uninstallationRequested(); 查询有关请求的组件更改的信息 所有这些函数都取决于包的先前状态。

关于Qt安装程序框架,我有一个问题:

如果当前在“组件选择”页面中选择安装此组件,如何签入组件脚本


没有组件属性,我找不到可以查询的值。

您可以使用这些函数

component.componentChangeRequested();
component.installationRequested();
component.updateRequested();
component.uninstallationRequested();
查询有关请求的组件更改的信息

所有这些函数都取决于包的先前状态。选中的已卸载软件包将在
installationRequested
中标记,未选中的已安装软件包将在
installationRequested
中标记,已安装版本早于捆绑版本的选中软件包将在
updateRequested
中标记


有关更多信息,请查看。

内置的
安装程序
对象可以返回所有组件的列表。 见:

“组件”对象除了Moose这里引用的方法外,还有一个
installed
属性。 见:

下面是一些有用的QtScript,可以根据您的用例进行剪切、粘贴和修改:

function getComponent( name ) {
    var comps=installer.components();
    for( i=0; i< comps.length; i++ ) {
        if( comps[i].name == name ) return comps[i];
    }
    throw new Error( "Component not found: " + name );
}

function isComponentInstalled( name ) {
    try{ return getComponent( name ).installed; }
    catch(e){ console.log( "Component not found: " + name ); }
    return false;
}

function isComponentSelected( name ) {
    try{ return getComponent( name ).installationRequested(); }
    catch(e){ console.log( "Component not found: " + name ); }
    return false;
}
函数getComponent(名称){ var comps=installer.components(); 对于(i=0;i