Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Dialog

A dialog with custom content and one or two buttons. More...

Import Statement: import Felgo 4.0
Inherits:

Item

Properties

Signals

Methods

Detailed Description

Dialog is a container type for displaying a modal dialog on the screen. It displays customizable content and one or two buttons, for positive and negative actions.

Dialog displays no content other than a title text and one or two buttons by default. To display simply a text message or text input, InputDialog can be used for convenience.

Example Usage

For example, to display a Dialog with an AppImage, the following code can be used:

 App {
   AppPage {

     AppButton {
       anchors.centerIn: parent
       text: "Custom Dialog"
       onClicked: customDialog.open()
     }

     Dialog {
       id: customDialog
       title: "Do you think this is awesome?"
       positiveActionLabel: "Yes"
       negativeActionLabel: "No"
       onCanceled: title = "Think again!"
       onAccepted: close()

       AppImage { //will be placed inside the dialogs content area
         anchors.fill: parent
         source: "../assets/vplay-logo.png"
         fillMode: Image.PreserveAspectFit
       }
     }
   }
 }

Property Documentation

[since Felgo 2.12.0] autoSize : bool

If set to true, the Dialog height will resize based on the content Items within your dialog, the default value is false. Your content items require a fixed height in this case and can not calculate it's size or position based on the Dialog height.

This property was introduced in Felgo 2.12.0.


[since Felgo 3.9.0] backgroundItem : Item

Allows to overwrite the default background of the dialog with a custom item. To hide the background, set backgorundItem to null.

This property was introduced in Felgo 3.9.0.


isOpen : bool

True, when the dialog is currently open. Changing this property has no effect, call Dialog::open() and Dialog::close() instead..


mainWindow : var

The Window where the dialog should be placed inside. If App is used as the root QML Item, this can be found automatically and does not need to be set.


negativeAction : bool

Set to true if a negative action button should be visible, with the text negativeActionLabel, which calls canceled signal on click.


negativeActionLabel : string

Text for the negativeAction button.


[since Felgo 2.10.0] opacityAnimation : alias

Allows to change properties of the opacity animation when showing or closing the dialog.

This property was introduced in Felgo 2.10.0.

See also scaleAnimation.


outsideTouchable : bool

Set this to true, to make the Dialog close, when the user touches the screen outside of it.


positiveAction : bool

Set to true if a positive action button should be visible, with the text positiveActionLabel, which calls accepted signal on click.


positiveActionLabel : string

Text for the positiveAction button.


[since Felgo 2.10.0] scaleAnimation : alias

Allows to change properties of the scale animation when showing or closing the dialog.

This property was introduced in Felgo 2.10.0.

See also opacityAnimation.


title : string

Title text displayed on top of the dialog.


[since Felgo 3.3.0] titleDividerVisible : alias

This property is used to display a divider below the dialog title. It uses the ThemeDialog::dividerHeight and ThemeDialog::dividerColor properties. The default value is false.

You can also set this globally for all dialogs using the ThemeDialog::titleDividerVisible property.

This property was introduced in Felgo 3.3.0.


[since Felgo 3.3.0] titleItem : AppText

Alias to the AppText item used for the title. Use this for advanced customization.

This property was introduced in Felgo 3.3.0.


Signal Documentation

accepted()

Called, when the positive action button was clicked. The Dialog will not close automatically when this signal is emitted.

Note: The corresponding handler is onAccepted.


canceled()

Called, when the negative action button was clicked. The Dialog will not close automatically when this signal is emitted.

Note: The corresponding handler is onCanceled.


[since Felgo 2.10.0] closed()

Called, when the dialog has been closed and is fully hidden.

Note: The corresponding handler is onClosed.

This signal was introduced in Felgo 2.10.0.

See also close().


[since Felgo 3.9.0] closing()

Called, when isOpen changes to false and the dialog is closing.

Note: The corresponding handler is onClosing.

This signal was introduced in Felgo 3.9.0.

See also opening().


[since Felgo 3.9.0] opening()

Called, when isOpen changes to true and the dialog is opening.

Note: The corresponding handler is onOpening.

This signal was introduced in Felgo 3.9.0.

See also closing().


Method Documentation

close()

Closes the dialog.

Returns true if it has been closed, and was not already closed before the call.


open()

Opens the dialog.

Returns true if it has been opened, and was not already opened before the call.


Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded