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

4
最近Qt在线安装程序的元数据更新导致了一些重大变化,这破坏了我的Windows CI/CD安装脚本。我已经解决了一个问题(绕过统计收集屏幕-请参见下面的DynamicTelemetryPluginFormCallback),但我遇到了另一个问题。在“选择组件”屏幕上,默认选中的软件包类别只是LTS,似乎没有办法从脚本中更改它。这意味着我无法安装最新版本Qt 5.13.1。我不能使用5.12,因为它没有我应用程序中正在使用的Qt Controls 2 SplitView。这是我当前的安装程序脚本,部分来源于此答案。它在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);
}

我正在使用<安装程序路径>.exe --script <安装程序脚本路径>.qs --verbose运行脚本。

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


你不能直接从 https://download.qt.io/ 下载吗? - Xatyrian
我可能会漏掉一些东西,但我认为那仍然是一个安装程序(https://download.qt.io/official_releases/qt/5.13/5.13.1/),我仍然需要自动化。我正在使用在线安装程序,因为我的CI / CD服务器(在这种情况下是Github Actions)一直卡在非常大的下载上,包括该安装程序。出于这个原因,我实际上还没有检查离线安装程序是否有不同的行为,回想起来它可能确实有。 - Joshua Wade
即使 Github Actions 没有 当前出现问题,我仍然想避免下载完整的 5.13.1 安装程序,因为我不需要下载的大部分内容。 - Joshua Wade
这看起来像是一个可直接使用的版本:https://download.qt.io/official_releases/qt/5.13/5.13.1/single/qt-everywhere-src-5.13.1.zip - Xatyrian
子模块可在子模块/子目录中使用。 - Xatyrian
那个版本绝对不是立即可用的;它是一个压缩文件中的完整Qt源代码。不是毫无用处,但只需要一些DLL和二进制文件时,我想避免从源代码构建整个Qt。构建Qt源代码也不是易事。它需要相当多的设置,虽然如果没有其他方法可行,我可能需要走这条路线。 - Joshua Wade
1个回答

4

我在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);
}

请查看Github上的此文件以获取完整示例。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接