Pages
API Documentation
On this page

PromptDialog QML Type

A simple dialog to quickly prompt a user with information, and possibly perform an action. More...

  • Import Statement: import org.kde.kirigami.dialogs
  • Inherits: Dialog

Detailed Description

Provides content padding (instead of padding outside of the scroll area). Also has a default preferredWidth, as well as the subtitle property.

Note: If a mainItem is specified, it will replace the subtitle label, and so the respective property will have no effect.

Example usage:

Kirigami.PromptDialog {
    title: "Reset settings?"
    subtitle: "The stored settings for the application will be deleted, with the defaults restored."
    standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel

    onAccepted: console.log("Accepted")
    onRejected: console.log("Rejected")
}

Text field prompt dialog:

Kirigami.PromptDialog {
    id: textPromptDialog
    title: qsTr("New Folder")

    standardButtons: Kirigami.Dialog.NoButton
    customFooterActions: [
        Kirigami.Action {
            text: qsTr("Create Folder")
            icon.name: "dialog-ok"
            onTriggered: {
                showPassiveNotification("Created");
                textPromptDialog.close();
            }
        },
        Kirigami.Action {
            text: qsTr("Cancel")
            icon.name: "dialog-cancel"
            onTriggered: {
                textPromptDialog.close();
            }
        }
    ]

    QQC2.TextField {
        placeholderText: qsTr("Folder name…")
    }
}

See also Dialog, MenuDialog

Property Documentation

contentBottomPadding : real

The bottom padding of the content, within the scroll area.

contentLeftPadding : real

The left padding of the content, within the scroll area.

contentPadding : real

The padding around the content, within the scroll area.

Default is Kirigami.Units.largeSpacing.

contentRightPadding : real

The right padding of the content, within the scroll area.

contentTopPadding : real

The top padding of the content, within the scroll area.

dialogType : int

This property holds the dialogType. It can be either:

By default, the dialogType is PromptDialog.None

iconName : string

This property holds the icon name used by the PromptDialog.

subtitle : string

The text to use in the dialog's contents.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.