Qt 安装程序脚本 API:在线安装程序中无法 select 最新的 Qt 版本

Qt installer scripting API: Can't select latest Qt version in online installer

Qt 在线安装程序对元数据的最新更新做出了一些重大更改,这些更改破坏了我 Windows CI/CD.

的安装脚本

我已经解决了一个问题(绕过统计信息收集屏幕 - 请参阅下面的 DynamicTelemetryPluginFormCallback),但我遇到了另一个问题。在 "Select Components" 屏幕上,默认选择的包类别现在只是 LTS,似乎没有办法从脚本中更改它。这意味着我无法安装最新的 Qt 版本 Qt 5.13.1。我不能使用 5.12,因为它没有 Qt Controls 2 SplitView, which I am using in my application. Here's my current installer script, partially sourced from this answer。 2019年10月8日前运行正常:

function Controller() {
    installer.autoRejectMessageBoxes();
    installer.setMessageBoxAutomaticAnswer("installationErrorWithRetry", QMessageBox.Ignore);
    installer.setMessageBoxAutomaticAnswer("installationError", QMessageBox.Ignore);
    installer.installationFinished.connect(function() {
        gui.clickButton(buttons.NextButton);
    });
}

Controller.prototype.WelcomePageCallback = function() {
    // click delay here because the next button is initially disabled for ~1 second
    gui.clickButton(buttons.NextButton, 10000);
}

Controller.prototype.CredentialsPageCallback = function() {
    gui.clickButton(buttons.NextButton);
}

Controller.prototype.IntroductionPageCallback = function() {
    gui.clickButton(buttons.NextButton);
}

Controller.prototype.DynamicTelemetryPluginFormCallback = function() {
    var widget = gui.currentPageWidget();
    widget.TelemetryPluginForm.statisticGroupBox.disableStatisticRadioButton.checked = true;
    gui.clickButton(buttons.NextButton);
}

Controller.prototype.TargetDirectoryPageCallback = function() {
    gui.currentPageWidget().TargetDirectoryLineEdit.setText("C:\Qt");
    gui.clickButton(buttons.NextButton);
}

Controller.prototype.ComponentSelectionPageCallback = function() {
    var widget = gui.currentPageWidget();

    console.log(JSON.stringify(widget));

    widget.ComponentsTreeView.

    widget.deselectAll();
    widget.selectComponent("qt.qt5.5131.win64_mingw73");
    widget.selectComponent("qt.tools.win64_mingw730");

    gui.clickButton(buttons.NextButton);
}

Controller.prototype.LicenseAgreementPageCallback = function() {
    gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
    gui.clickButton(buttons.NextButton);
}

Controller.prototype.StartMenuDirectoryPageCallback = function() {
    gui.clickButton(buttons.NextButton);
}

Controller.prototype.ReadyForInstallationPageCallback = function() {
    gui.clickButton(buttons.NextButton);
}

Controller.prototype.FinishedPageCallback = function() {
    var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm;
    if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) {
        checkBoxForm.launchQtCreatorCheckBox.checked = false;
    }
    gui.clickButton(buttons.FinishButton);
}

我运行脚本<path to installer>.exe --script <path to installer script>.qs --verbose

运行 使用此安装脚本的在线安装程序不会导致任何错误,但它不会安装 qt.qt5.5131.win64_mingw73.

我在 Github 上找到了一个示例来解决我的问题。我的 ComponentSelectionPageCallback 现在看起来像这样:

Controller.prototype.ComponentSelectionPageCallback = function() {
    var page = gui.pageWidgetByObjectName("ComponentSelectionPage");

    var checkBox = gui.findChild(page, "Latest releases");
    var fetchButton = gui.findChild(page, "FetchCategoryButton");

    checkBox.click();
    fetchButton.click();

    var widget = gui.currentPageWidget();

    widget.deselectAll();
    widget.selectComponent("qt.qt5.5131.win64_mingw73");
    widget.selectComponent("qt.tools.win64_mingw730");

    gui.clickButton(buttons.NextButton);
}

有关完整示例,请参阅 this file on Github