Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable native Next button in Qt installer framework

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?

like image 379
Grigory Avatar asked Sep 20 '17 19:09

Grigory


2 Answers

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
    }
}
like image 67
dydil Avatar answered Sep 30 '22 16:09

dydil


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.

like image 34
Grigory Avatar answered Sep 30 '22 17:09

Grigory