From 10:00 CET Friday 22nd November we will adjust how the server works to deal with some recently reported problems. Therefore there may be a load problem, if you experience more problems than usual trying to access the forum then please PM AndyS or any of the moderators so they can inform me.


Qt Installer Framework: How to allow only Updates?



  • I am attempting to create an updater tool for my already installed application in a locked-down system. The Maintenance tool from the Qt Installer Framework seems perfect, with its integration with remote repositories, but I would need to remove the "Add" and "Remove" components options, leaving only the "Update" option.

    I already tried installer.removeWizardPageItem(component, "UninstallerRadioButton")
    and gui.pageById(QInstaller.Introduction).UninstallerRadioButton.hide()
    with no success :-(

    Is there any way to remove those radio buttons by using scripting?



  • Solution:

    Controller.prototype.IntroductionPageCallback = function()
    {
        // Installer is "updater" when it is run with "--updater"
        // or Controller does "installer.setUpdater()"
        if (installer.isUpdater()) {
            var widget = gui.currentPageWidget(); // Same as gui.pageById(QInstaller.Introduction);
            widget.findChild("UpdaterRadioButton").checked = true;
            
            // Disable paint events on these widgets, through the QWidget::updatesEnabled property.
            // I tried with the "visible" property, but it is not enough, because for some reason
            // that property gets reset under some conditions. For example, if "Next" button is pressed
            // and no updates are available.
            widget.findChild("PackageManagerRadioButton").updatesEnabled = false;
            widget.findChild("UninstallerRadioButton").updatesEnabled = false;
        }
    }