installer

Provides access to core functionality of the Qt Installer Framework. More...

Signals

Methods

Detailed Description

Signal Documentation

aboutCalculateComponentsToInstall()

Emitted before the ordered list of components to install is calculated.

Note: The corresponding handler is onAboutCalculateComponentsToInstall.


aboutCalculateComponentsToUninstall()

Emitted before the ordered list of components to uninstall is calculated.

Note: The corresponding handler is onAboutCalculateComponentsToUninstall.


componentAdded(Component component)

Emitted when a new root component is added.

Note: The corresponding handler is onComponentAdded.

See also rootComponentsAdded() and updaterComponentsAdded().


coreNetworkSettingsChanged()

Emitted when the network settings are changed.

Note: The corresponding handler is onCoreNetworkSettingsChanged.


currentPageChanged(int page)

Emitted when the current page changes.

Note: The corresponding handler is onCurrentPageChanged.


downloadArchivesFinished()

Emitted when all data archives for components have been downloaded successfully.

Note: The corresponding handler is onDownloadArchivesFinished.


finishAllComponentsReset(list<Component> rootComponents)

Triggered when the list of new root components rootComponents has been updated.

Note: The corresponding handler is onFinishAllComponentsReset.

See also startAllComponentsReset().


finishButtonClicked()

Emitted when the user clicks the Finish button of the installer.

Note: The corresponding handler is onFinishButtonClicked.


finishUpdaterComponentsReset(list<Component> componentsWithUpdates)

Triggered when the list of available remote updates componentsWithUpdates has been updated.

Note: The corresponding handler is onFinishUpdaterComponentsReset.


finishedCalculateComponentsToInstall()

Emitted after the ordered list of components to install was calculated.

Note: The corresponding handler is onFinishedCalculateComponentsToInstall.


finishedCalculateComponentsToUninstall()

Emitted after the ordered list of components to uninstall was calculated.

Note: The corresponding handler is onFinishedCalculateComponentsToUninstall.


installationFinished()

Triggered when installation has finished.

Note: The corresponding handler is onInstallationFinished.

See also installationStarted() and installationInterrupted().


installationInterrupted()

Triggered when installation has been interrupted (cancelled).

Note: The corresponding handler is onInstallationInterrupted.

See also interrupt(), installationStarted(), and installationFinished().


installationStarted()

Triggered when installation has started.

Note: The corresponding handler is onInstallationStarted.

See also installationFinished() and installationInterrupted().


metaJobInfoMessage(string message)

Triggered with informative updates, message, of the communication with a remote repository.

Note: The corresponding handler is onMetaJobInfoMessage.


metaJobProgress(int progress)

Triggered with progress updates of the communication with a remote repository. Progress ranges from 0 to 100.

Note: The corresponding handler is onMetaJobProgress.


metaJobTotalProgress(int progress)

Triggered when total progress value of the communication with a remote repository changes.

Note: The corresponding handler is onMetaJobTotalProgress.


offlineGenerationFinished()

Triggered when offline installer generation has finished.

Note: The corresponding handler is onOfflineGenerationFinished.

See also offlineGenerationStarted().


offlineGenerationStarted()

Triggered when offline installer generation has started.

Note: The corresponding handler is onOfflineGenerationStarted.

See also offlineGenerationFinished().


rootComponentsAdded(list<Component> components)

Emitted when a new list of root components is added.

Note: The corresponding handler is onRootComponentsAdded.

See also componentAdded() and updaterComponentsAdded().


setAutomatedPageSwitchEnabled(bool request)

Triggered when the automatic switching from PerformInstallation to InstallationFinished page is enabled (request = true) or disabled (request = false).

The automatic switching is disabled automatically when for example the user expands or unexpands the Details section of the PerformInstallation page.

Note: The corresponding handler is onSetAutomatedPageSwitchEnabled.


setValidatorForCustomPageRequested(Component component, string name, string callbackName)

Requests that a validator be set for the custom page specified by name and callbackName for the component component. Triggered when setValidatorForCustomPage() is called.

Note: The corresponding handler is onSetValidatorForCustomPageRequested.


startAllComponentsReset()

Triggered when the list of components starts to get updated.

Note: The corresponding handler is onStartAllComponentsReset.

See also finishAllComponentsReset().


startUpdaterComponentsReset()

Triggered when components start to get updated during a remote update.

Note: The corresponding handler is onStartUpdaterComponentsReset.


statusChanged(Status status)

Emitted when the installer status changes.

Note: The corresponding handler is onStatusChanged.


titleMessageChanged(string title)

Emitted when the text of the installer status (on the PerformInstallation page) changes to title.

Note: The corresponding handler is onTitleMessageChanged.


uninstallationFinished()

Triggered when uninstallation has finished.

Note: The corresponding handler is onUninstallationFinished.

See also uninstallationStarted().


uninstallationStarted()

Triggered when uninstallation has started.

Note: The corresponding handler is onUninstallationStarted.

See also uninstallationFinished().


updateFinished()

Triggered when an update has finished.

Note: The corresponding handler is onUpdateFinished.


updaterComponentsAdded(list<Component> components)

Emitted when a new list of updater components is added.

Note: The corresponding handler is onUpdaterComponentsAdded.

See also componentAdded() and rootComponentsAdded().


valueChanged(string key, string value)

Emitted when a value for key changes.

Note: The corresponding handler is onValueChanged.

See also setValue().


wizardPageInsertionRequested(Widget widget, WizardPage page)

Emitted when a custom widget is about to be inserted into page by addWizardPage.

Note: The corresponding handler is onWizardPageInsertionRequested.


wizardPageRemovalRequested(Widget widget)

Emitted when a widget is removed by removeWizardPage.

Note: The corresponding handler is onWizardPageRemovalRequested.


wizardPageVisibilityChangeRequested(bool visible, int page)

Emitted when the visibility of the page with id page changes to visible.

Note: The corresponding handler is onWizardPageVisibilityChangeRequested.

See also setDefaultPageVisible().


wizardWidgetInsertionRequested(Widget widget, WizardPage page, int position)

Emitted when a widget is inserted into page by addWizardPageItem ordered by position.

Note: The corresponding handler is onWizardWidgetInsertionRequested.


wizardWidgetRemovalRequested(Widget widget)

Emitted when a widget is removed by removeWizardPageItem.

Note: The corresponding handler is onWizardWidgetRemovalRequested.


Method Documentation

void addUserRepositories(stringlist repositories)

Registers additional repositories.

See also setTemporaryRepositories().


boolean addWizardPage(Component component, string name, int page)

Adds the widget with objectName() name registered by component as a new page into the installer's GUI wizard. The widget is added before page.

See Controller Scripting for the possible values of page.

Returns true if the operation succeeded.

See also removeWizardPage() and setDefaultPageVisible().


boolean addWizardPageItem(Component component, string name, int page, int position)

Adds the widget with objectName() name registered by component as a GUI element into the installer's GUI wizard. The widget is added on page ordered by position. If several widgets are added to the same page, the widget with lower position number will be inserted on top.

See Controller Scripting for the possible values of page.

See also removeWizardPageItem() and wizardWidgetInsertionRequested().


void autoAcceptMessageBoxes()

Automatically accept all user message boxes.

See also autoRejectMessageBoxes() and setMessageBoxAutomaticAnswer().


void autoRejectMessageBoxes()

Automatically reject all user message boxes.

See also autoAcceptMessageBoxes() and setMessageBoxAutomaticAnswer().


boolean calculateComponentsToInstall()

Calculates an ordered list of components to install based on the current run mode. Also auto installed dependencies are resolved. The aboutCalculateComponentsToInstall() signal is emitted before the calculation starts, the finishedCalculateComponentsToInstall() signal once all calculations are done.


boolean calculateComponentsToUninstall()

Calculates a list of components to uninstall based on the current run mode. Auto installed dependencies are not yet resolved. The aboutCalculateComponentsToUninstall() signal is emitted before the calculation starts, the finishedCalculateComponentsToUninstall() signal once all calculations are done. Always returns true.


void cancelMetaInfoJob()

Cancels the retrieval of meta information from a remote repository.


array components(string regexp)

Returns an array of all components currently available. If the repository metadata have not been fetched yet, the array will be empty. Optionally, a regexp expression can be used to further filter the listed packages.

See also component, finishAllComponentsReset(), and finishUpdaterComponentsReset().


boolean containsFileDialogAutomaticAnswer(string identifier)

Returns true if QFileDialog with the ID identifier has an automatic answer set.

See also setFileDialogAutomaticAnswer() and removeFileDialogAutomaticAnswer().


boolean containsValue(string key)

Returns true if the installer contains a value for key.

See also value, setValue, and valueChanged.


void deselectComponent(string id)

Deselects the component with id.


void dropAdminRights()

Drops admin rights gained by gainAdminRights.

See also gainAdminRights().


string environmentVariable(string name)

Returns the content of the environment variable name. An empty string is returned if the environment variable is not set.


array execute(string program, stringlist arguments = undefined, string stdIn = "", string stdInCodec = "latin1", string stdOutCodec = "latin1")

Starts the program program with the arguments arguments in a new process and waits for it to finish.

stdIn is sent as standard input to the application.

stdInCodec is the name of the codec to use for converting the input string into bytes to write to the standard input of the application.

stdOutCodec is the name of the codec to use for converting data written by the application to standard output into a string.

Returns an empty array if the program could not be executed, otherwise the output of command as the first item, and the return code as the second.

Note: On Unix, the output is just the output to stdout, not to stderr.

See also executeDetached().


boolean executeDetached(string program, stringlist arguments = undefined, string workingDirectory = "")

Starts the program program with the arguments arguments in a new process, and detaches from it. Returns true on success; otherwise returns false. If the installer exits, the detached process will continue to live.

Note: Arguments that contain spaces are not passed to the process as separate arguments.

Unix: The started process will run in its own session and act like a daemon.

Windows: Arguments that contain spaces are wrapped in quotes. The started process will run as a regular standalone process.

The process will be started in the directory workingDirectory.


boolean fileExists(string filePath)

Returns true if the filePath exists; otherwise returns false.

Note: If the file is a symlink that points to a non existing file, false is returned.


string findLibrary(string name, stringlist paths = [])

Finds a library named name in paths. If paths is empty, it gets filled with platform dependent default paths. The resulting path is returned.

This method can be used by scripts to check external dependencies.

See also findPath.


string findPath(string name, stringlist paths = [])

Tries to find a file name name in one of paths. The resulting path is returned.

This method can be used by scripts to check external dependencies.

See also findLibrary.


string fromNativeSeparators(string path)

Returns path using '/' as file separator.

On Unix platforms the returned string is the same as the argument.

Note: Predefined variables, such as @TargetDir@, are not resolved by this function. To convert the separators to predefined variables, use installer.value() to resolve the variables first.

See also toNativeSeparators() and value().


boolean gainAdminRights()

Tries to gain admin rights. On success, it returns true.

See also dropAdminRights().


bool hasAdminRights()

Returns true if the installer has admin rights. For example, if the installer was started with a root account, or the internal admin rights elevation is active.

Returns false otherwise.

See also gainAdminRights() and dropAdminRights().


void interrupt()

Cancels an ongoing installation.

See also installationInterrupted.


boolean isCommandLineDefaultInstall()

Returns true if installation is performed with default components.


boolean isCommandLineInstance()

Returns true if running as command line instance.


boolean isFileExtensionRegistered(string extension)

Returns whether a file extension is already registered in the Windows registry. Returns false on all other platforms.


boolean isInstaller()

Returns true if the application, binary, or executable is executed in installer mode.

See also isUninstaller, isUpdater, and isPackageManager.


boolean isOfflineGenerator()

Returns true if the application is executed in offline generation mode.


boolean isOfflineOnly()

Returns true if this is an offline-only installer.


boolean isPackageManager()

Returns true if the the application, binary, or executable is executed in package manager mode.

See also setPackageManager, isInstaller, isUninstaller, and isUpdater.


boolean isPackageViewer()

Returns true if the current installer is executed as package viewer.


boolean isProcessRunning(string name)

Returns true if a process with name is running. On Windows, the comparison is case-insensitive.


boolean isUninstaller()

Returns true if the the application, binary, or executable is executed in uninstaller mode.

See also setUninstaller, isInstaller, isUpdater, and isPackageManager.


boolean isUpdater()

Returns true if the the application, binary, or executable is executed in updater mode.

See also setUpdater, isInstaller, isUninstaller, and isPackageManager.


boolean isUserSetBinaryMarker()

Returns true if the magic binary marker has been set by user.


string key(string value)

Returns the installer key for value. If value is not known, empty string is returned.


boolean killProcess(string absoluteFilePath)

Returns true if a process with absoluteFilePath could be killed or is not running.

Note: This is implemented in a semi blocking way (to keep the main thread to paint the UI).


void languageChanged()

Calls languangeChanged on all components.


boolean localInstallerBinaryUsed()

Returns false if the installer is run on Windows, and the installer has been started from a remote file system drive. Otherwise returns true.

See also setDependsOnLocalInstallerBinary().


boolean performOperation(string name, stringlist arguments)

Instantly performs the operation name with arguments.


string readConsoleLine(string title, int maxlen)

Prints title to a console and reads console input. Function halts the installer and waits for user input. Function returns a line which user has typed into the console. The maximum allowed line length is set to maxlen. If the stream contains lines longer than this, then the line is split after maxlen characters. If maxlen is 0, the line can be of any length.

Note: This function can only be called when installing from a command line instance without GUI.


string readFile(string filePath, string codecName)

Returns the contents of the file filePath using the encoding specified by codecName. The file is read in the text mode, that is, end-of-line terminators are translated to the local encoding.

Note: If the file does not exist or an error occurs while reading the file, an empty string is returned.


boolean recalculateAllComponents()

Recalculates all components to install and uninstall. Returns true on success, false otherwise.


void removeFileDialogAutomaticAnswer(string identifier)

Removes the automatic answer from QFileDialog with the ID identifier.

See also setFileDialogAutomaticAnswer().


boolean removeWizardPage(Component component, string name)

Removes the widget with objectName() name previously added to the installer's wizard by component.

Returns true if the operation succeeded.

See also addWizardPage(), setDefaultPageVisible(), and wizardPageRemovalRequested().


boolean removeWizardPageItem(Component component, string name)

Removes the widget with objectName() name previously added to the installer's wizard by component.

See also addWizardPageItem().


float requiredDiskSpace()

Returns the additional estimated amount of disk space in bytes required after installation.

See also requiredTemporaryDiskSpace().


float requiredTemporaryDiskSpace()

Returns the estimated required disk space during installation in bytes.

See also requiredDiskSpace().


boolean runInstaller()

Runs the installer. Returns true on success, false otherwise.


boolean runOfflineGenerator()

Runs the offline generator. Returns true on success, false otherwise.


boolean runPackageUpdater()

Runs the package updater. Returns true on success, false otherwise.


boolean runUninstaller()

Runs the uninstaller. Returns true on success, false otherwise.


void selectComponent(string id)

Selects the component with id.


void setAutoAcceptLicenses()

Automatically accepts all license agreements required to install the selected components. This can be used to skip the command line license acceptance query. The names of the accepted individual licenses are still printed to a console.


void setCanceled()

Cancels the installation.


void setCompleteUninstallation(bool complete)

Sets the uninstallation to be complete. If complete is false, only components deselected by the user will be uninstalled. This option applies only on uninstallation.


boolean setDefaultPageVisible(int page, boolean visible)

Sets the visibility of the default page with the ID page to visible. That is, removes it from or adds it to the wizard. This works only for pages that were in the installer when it was started.

Returns true.

See also addWizardPage() and removeWizardPage().


void setDependsOnLocalInstallerBinary()

Makes sure the installer runs from a local drive. Otherwise the user will get an appropriate error message.

Note: This only works on Windows.

See also localInstallerBinaryUsed().


void setFileDialogAutomaticAnswer(string identifier, string value)

Automatically sets the existing directory or filename value to QFileDialog with the ID identifier.

See also removeFileDialogAutomaticAnswer().


void setInstaller()

Forces an installer context.

See also isInstaller, setUpdater, setUninstaller, and setPackageManager.


void setInstallerBaseBinary(string path)

Sets the installerbase binary to use when writing the maintenance tool. Set the path if an update to the binary is available.

If not set, the executable segment of the running installer or uninstaller will be used.


void setMessageBoxAutomaticAnswer(string identifier, int button)

Automatically close the message box with ID identifier as if the user had pressed button.

This can be used for unattended (automatic) installations.

See also QMessageBox, autoAcceptMessageBoxes(), and autoRejectMessageBoxes().


void setPackageManager()

Forces a package manager context.

See also isPackageManager().


void setSharedFlag(string key, boolean value)

Sets a shared flag with name key to value. This is one option to share information between scripts.

Deprecated since 2.0.0. Use setValue instead.

See also sharedFlag().


void setTemporaryRepositories(stringlist repositories, boolean replace)

Sets additional repositories for this instance of the installer or updater. If replace is true, existing repositories will be replaced. Will be removed after invoking it again.

See also addUserRepositories().


void setUninstaller()

Forces an uninstaller context.

See also isUninstaller, setUpdater, setPackageManager, and setInstaller.


void setUpdater()

Forces an updater context.

See also isUpdater, setUninstaller, setPackageManager, and setInstaller.


void setValidatorForCustomPage(Component component, string name, string callbackName)

Sets a validator for the custom page specified by name and callbackName for the component component.

See also setValidatorForCustomPageRequested().


void setValue(string key, string value)

Sets the installer value for key to value.

See also value, containsValue, and valueChanged.


boolean sharedFlag(string key)

Returns shared flag with name key. This is one option to share information between scripts.

Deprecated since 2.0.0. Use value or values instead.

See also setSharedFlag().


string toNativeSeparators(string path)

Returns path with the '/' separators converted to separators that are appropriate for the underlying operating system.

On Unix platforms the returned string is the same as the argument.

Note: Predefined variables, such as @TargetDir@, are not resolved by this function. To convert the separators to predefined variables, use installer.value() to resolve the variables first.

See also fromNativeSeparators() and value().


string value(string key, string defaultValue = "", int format = 0)

Returns the installer value for key. If key is not known to the system, defaultValue is returned. Additionally, on Windows, key can be a registry key. Optionally, you can specify the format of the registry key. By default the format is QSettings::NativeFormat. For accessing the 32-bit system registry from a 64-bit application running on 64-bit Windows, use QSettings::Registry32Format. For accessing the 64-bit system registry from a 32-bit application running on 64-bit Windows, use QSettings::Registry64Format.

See also setValue, containsValue, and valueChanged.


stringlist values(string key, stringlist defaultValue = [])

Returns the installer value for key. If key is not known to the system, defaultValue is returned. Additionally, on Windows, key can be a registry key.

See also value.


boolean versionMatches(string version, string requirement)

Returns true when version matches the requirement. requirement can be a fixed version number or it can be prefixed by the comparators '>', '>=', '<', '<=' and '='.


© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. The Qt Company, Qt and their respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.