Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Disable 'Cancel' & 'Close' buttons in install.qs



  • Hi. I have an extremely simple requirement.

    I have a working script, which is copied from the sample 'install.qs', for a product called 'OpenStudio' which can be driven by QT script. I However, as the installation time is quite lengthy and our users, like most, are extremely impatient, I want to disable the 'Cancel' and 'Close' buttons, if that's possible.

    Here's the script:

    Controller.prototype.IntroductionPageCallback = function () {
      gui.clickButton(buttons.NextButton)
    }
    
    Controller.prototype.ComponentSelectionPageCallback = function () {
      var widget = gui.currentPageWidget();
      
      if (widget != null) {
        // to install a subset of components, uncomment the code below and edit as neccesary
        //widget.deselectAll();
        //widget.selectComponent('SketchUpPlugin');
        //widget.selectComponent('CLI');
        //widget.selectComponent('RubyAPI');
        //widget.selectComponent('CSharpAPI');
        //widget.selectComponent('PAT');
        //widget.selectComponent('OpenStudioApp');
        //widget.selectComponent('DView');
        //widget.selectComponent('EnergyPlus');
        //widget.selectComponent('Radiance');
        //widget.selectComponent('Resources');
      
        gui.clickButton(buttons.NextButton);
      }
    }
    
    Controller.prototype.TargetDirectoryPageCallback = function () {
      // set install directory if needed
      var widget = gui.currentPageWidget();
      if (widget != null) {
        widget.TargetDirectoryLineEdit.setText("c:\\openstudio-2.9.1")
        gui.clickButton(buttons.NextButton);
      }
    }
    
    Controller.prototype.StartMenuDirectoryPageCallback = function () {
      gui.clickButton(buttons.NextButton);
    }
    
    Controller.prototype.ReadyForInstallationPageCallback = function () {
      gui.clickButton(buttons.NextButton);
    }
    
    Controller.prototype.FinishedPageCallback = function () {
      gui.clickButton(buttons.FinishButton);
    }
    
    


  • @VBScab
    Did you try disabling button something like this ?



  • I tried

    buttons.CancelButton.disabled = true;
    

    in each 'Controller' section, to no avail



  • I just tried this:

      var widget = gui.currentPageWidget();
      if (widget != null) {
        var cancelButton = gui.findChild(widget, "Cancel");
        if (cancelButton != null) {
        	cancelButton.setEnabled(false);
        }
      }
    

    Again...the Cancel button is still enabled.



  • Just tried this:

    Controller.prototype.ReadyForInstallationPageCallback = function () {
        var page = gui.pageWidgetByObjectName("ReadyForInstallationPage");
    
        var cancelButton = gui.findChild(page, "CancelButton");
        if (cancelButton != null) {
            console.log("cancelButton found");
            cancelButton.setEnabled(false);
            cancelButton.enabled = false;
        } else {
            console.log("cancelButton NOT found");
        }
        //  gui.clickButton(buttons.NextButton);
    }
    

    Again, the 'Cancel' button is still present/enabled.


Log in to reply