Dialog

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

Import Statement: import VPlayApps 1.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 {
   Page {

     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

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 accepted signal on click.


negativeActionLabel : string

Text for the negativeAction button.


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 canceled signal on click.


positiveActionLabel : string

Text for the positiveAction button.


title : string

Title text displayed on top of the dialog.


Signal Documentation

accepted()

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


canceled()

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


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.


Videos

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support