【问题标题】:Qt installer scripting API: Can't select latest Qt version in online installerQt 安装程序脚本 API:无法在在线安装程序中选择最新的 Qt 版本
【发布时间】:2020-02-07 04:43:09
【问题描述】:

最近对 Qt 在线安装程序提取的元数据进行了一些重大更改,这些更改破坏了我的 Windows CI/CD 安装脚本。

我已经解决了一个问题(绕过统计信息收集屏幕 - 请参阅下面的 DynamicTelemetryPluginFormCallback),但我遇到了另一个问题。在“选择组件”屏幕上,默认选择的包类别现在只是 LTS,似乎没有办法从脚本中更改它。这意味着我无法安装最新的 Qt 版本 Qt 5.13.1。我不能使用 5.12,因为它没有我在我的应用程序中使用的 Qt Controls 2 SplitView。这是我当前的安装程序脚本,部分来自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

【问题讨论】:

  • 不能直接从download.qt.io下载吗?
  • 我可能遗漏了一些东西,但我认为这仍然是一个安装程序 (download.qt.io/official_releases/qt/5.13/5.13.1),我仍然需要将其自动化。我正在使用在线安装程序,因为我的 CI/CD 服务器(在本例中为 Github Actions)一直挂在非常大的下载中,包括该安装程序。出于这个原因,我实际上并没有检查离线安装程序,看看它的行为是否有所不同,事后看来它可能确实如此。
  • 即使 Github Actions 不是 currently breaking,我仍然希望避免下载完整的 5.13.1 安装程序,因为我不需要下载的大部分内容。
  • 子模块在子模块/子目录中可用

标签: qt qt5 qt-installer


【解决方案1】:

我在 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-22
    • 1970-01-01
    • 1970-01-01
    • 2017-01-06
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 2014-06-03
    相关资源
    最近更新 更多