我想我有 2 个可行的解决方案。
第一个解决方案,如果您想要一个单页卸载程序:
您需要像之前开始的那样创建一个控制器:
function Controller() {
if (installer.isUninstaller()) {
installer.setDefaultPageVisible(QInstaller.Introduction, false);
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);
}
}
这将禁用经典安装/卸载工作流程中的所有页面。确保检查您是否处于卸载模式。
如果你想要一个 2 页的卸载程序:
function Controller()
{
}
Controller.prototype.IntroductionPageCallback = function()
{
if (installer.isUninstaller()) {
// Get the current wizard page
var widget = gui.currentPageWidget();
if (widget != null) {
// Don't show buttons because we just want to uninstall the software
widget.findChild("PackageManagerRadioButton").visible = false;
widget.findChild("UpdaterRadioButton").visible = false;
widget.findChild("UninstallerRadioButton").visible = false;
}
}
}
奖金
在安装程序模式下,默认选择“我接受”许可协议。说真的,谁没有?
Controller.prototype.LicenseAgreementPageCallback = function()
{
var widget = gui.currentPageWidget();
if (widget != null) {
widget.AcceptLicenseRadioButton.checked = true;
}
}