installscript.qs Example File

openreadme/packages/or.qtproject.ifw.example.openreadme/meta/installscript.qs
 /* Copyright (C) 2026 The Qt Company Ltd.
  *
  * SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
 */

 function Component()
 {
     installer.installationFinished.connect(this, Component.prototype.installationFinishedPageIsShown);
     installer.finishButtonClicked.connect(this, Component.prototype.installationFinished);
 }

 Component.prototype.createOperations = function()
 {
     component.createOperations();
 }

 Component.prototype.installationFinishedPageIsShown = function()
 {
     try {
         if (installer.isInstaller() && installer.status == QInstaller.Success) {
             installer.addWizardPageItem( component, "ReadMeCheckBoxForm", QInstaller.InstallationFinished );
         }
     } catch(e) {
         console.log(e);
     }
 }

 Component.prototype.installationFinished = function()
 {
     try {
         if (installer.isInstaller() && installer.status == QInstaller.Success) {
             var checkboxForm = component.userInterface( "ReadMeCheckBoxForm" );
             if (checkboxForm && checkboxForm.readMeCheckBox.checked) {
                 QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/README.txt");
             }
         }
     } catch(e) {
         console.log(e);
     }
 }