API сценариев установщика Qt: Невозможно выбрать последнюю версию Qt в онлайн-установщике - PullRequest
3 голосов
/ 09 октября 2019

Недавнее обновление метаданных, извлеченных онлайн-установщиком Qt, внесло некоторые существенные изменения, которые нарушили мой скрипт установки для Windows CI / CD.

Я решил одну проблему (в обход экрана сбора статистики)- см. DynamicTelemetryPluginFormCallback ниже), но у меня возникла проблема с другой проблемой. На экране «Выбор компонентов» выбранная по умолчанию категория пакета теперь просто LTS, и, похоже, нет способа изменить ее из сценария. Это означает, что я не могу установить последнюю версию Qt, Qt 5.13.1. Я не могу использовать 5.12, поскольку у него нет Qt Controls 2 SplitView , который я использую в своем приложении. Вот мой текущий установочный скрипт, частично полученный из этого ответа . До 8 октября 2019 года все работало нормально:

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.

1 Ответ

3 голосов
/ 11 октября 2019

Я нашел пример на 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 для полного примера.

...