Disable native Next button in Qt installer framework
Asked Answered
A

2

7

I have to disable standard next button, on my custom page via installscript.qs file.

I can disable my own button (that I created in .ui file) via .qs script like this: widget.myButton.setEnabled(false);

This man shows that native buttons represented as enumeration and I cannot disable them same way.

Controller Scripting manual page shows some interactions with native buttons. Like gui.clickButton(buttons.NextButton). I go through whole gui object man and don't found anything useful.

Qt installer framework has a native license check page with Next button logic that I need, but I have not found any samples that do it manually. (license page work because its default license page and it's logic inside framework as I understand).

Finally I found isComplete() method that can be useful for me, but it is for C++ API not for qs. So how to disable native button via installscript.qs file?

Ammonal answered 20/9, 2017 at 19:45 Comment(0)
C
5

In case someone else end ups here, I finally found a cleaner solution: a dynamic widget has a property complete that can be changed to enable and disable the "Next" button. Set it to false to disable the button.

Controller.prototype.DynamicMyWidgetCallback = function()
{
    var currentWidget = gui.currentPageWidget();
    if (currentWidget != null)
    {
        currentWidget.complete = false
    }
}
Canaster answered 4/8, 2018 at 16:13 Comment(1)
Any suggestion on how to remove the button?Kalman
A
1

The only solution i had found is call installer.setValue("canContinue" "false");

Then connect page entered event using gui.pageById(QInstaller.TargetDirectory).entered. connect(Component.prototype.targetPageEntered);

In targetPageEntered check our value:

Component.prototype.targetPageEntered = function () {
    if (installer.value("canContinue") != "true") {
        gui.clickButton(buttons.BackButton);
        QMessageBox.information("someid", "Installer", 
        "You must do smth to continue", QMessageBox.Ok);
    }
}

Of course you need to change the installer.value when user complete required actions.

Ammonal answered 24/9, 2017 at 22:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.