Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Creating a Qt Non-Interactive Uninstaller
Forum Update on Monday, May 27th 2025

Creating a Qt Non-Interactive Uninstaller

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
2 Posts 2 Posters 820 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anshah
    wrote on 7 Jun 2019, 16:59 last edited by
    #1

    Currently, I have a non-interactive script I use when installing Qt 5.8, which I call as follows:

    $ sudo ./qt-opensource-linux-x64-5.8.0.run --script qt-noninteractive.qs
    

    The contents of the install script are as follows:

    qt-noninteractive.qs

    function Controller() {
        installer.autoRejectMessageBoxes();
        installer.installationFinished.connect(function() {
            gui.clickButton(buttons.NextButton);
        })
    }
    
    Controller.prototype.WelcomePageCallback = function() {
        gui.clickButton(buttons.NextButton, 3000);
    }
    
    Controller.prototype.CredentialsPageCallback = function() {
        gui.clickButton(buttons.NextButton);
    }
    
    Controller.prototype.IntroductionPageCallback = function() {
        gui.clickButton(buttons.NextButton);
    }
    
    Controller.prototype.TargetDirectoryPageCallback = function()
    {
        gui.currentPageWidget().TargetDirectoryLineEdit.setText("/opt/Qt5.8.0");
        gui.clickButton(buttons.NextButton);
    }
    
    Controller.prototype.ComponentSelectionPageCallback = function() {
        var widget = gui.currentPageWidget();
    
        widget.selectAll();
        widget.deselectComponent('qt.580.src');
        widget.deselectComponent("qt.tools.qtcreator");
    
        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);
    }
    

    This script runs successfully and the install completes with no issues.

    How would I go about running and creating a corresponding uninstall script?

    Would the call look something like this:

    sudo ./MaintenanceTool --script qt-noninteractive-uninstall.qs
    
    1 Reply Last reply
    0
    • J Offline
      J Offline
      joaijala
      wrote on 13 Jun 2019, 12:02 last edited by
      #2

      You could just copy-paste the .qs script you are using for installing and replace the CredentialsPageCallback function with:

      Controller.prototype.CredentialsPageCallback = function()
      {
      var page = gui.pageWidgetByObjectName("CredentialsPage");
      page.loginWidget.EmailLineEdit.setText("email@address");
      page.loginWidget.PasswordLineEdit.setText("foo");
      page.uninstallCheckBox.setChecked(true);
      gui.clickButton( buttons.NextButton);
      }

      Most of the other callbacks are not needed for uninstalling, they can be cleaned up, but it doesn't hurt to have them there either.
      Hope that helps!

      1 Reply Last reply
      1

      1/2

      7 Jun 2019, 16:59

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved