[Interest] Modal busyIndicator in Android

Rutledge Shawn Shawn.Rutledge at theqtcompany.com
Wed Jun 3 10:04:52 CEST 2015


On 3 Jun 2015, at 04:07, Federico Buti <bacarozzo at gmail.com> wrote:

> Hi list,
> 
> in the attempt to look as native as possible, I've defined a QML busy indicator for Android as follows:
> 
> Dialog {
>     property alias text: labelWorking.text
>     standardButtons: StandardButton.NoButton
...
>     Keys.onPressed: {
>         if (event.key == Qt.Key_Back) {
>             console.log("Back button captured - wunderbar !")
>             event.accepted = true
>         }
>     }
> }
> 
> As you can see it is quite simple but works perfectly fine for my needs. However, the dialog should be "fully modal" and It should be dismiss ONLY when the related background task is terminated. As it is now, the dialog is dismiss as soon as the Android back button is pressed, which is wrong for my use case. How can I handle it? 

There is still a surrounding key handler in DefaultDialogWrapper.qml, because we wouldn’t want it to be too easy to break the default behavior: most dialogs should be dismissed when you hit the back button.  So content which is merely added to the Dialog’s default property does not get the chance to break it.

Instead you can override the Dialog’s contentItem, which is also another way to get rid of the buttons.




More information about the Interest mailing list