Pages
API Documentation
On this page

MessageDialog QML Type

A message dialog with success, warning, error, and information styles. More...

  • Import Statement: import org.kde.kirigamiaddons.components.templates
  • Inherited By: MessageDialog (org.kde.kirigamiaddons.components)

Detailed Description

Set the title and subtitle to describe the message, choose a dialogType, and set standardButtons for the available actions. Add extra content as child items; it appears below the title and subtitle.

import QtQuick.Controls as Controls
import org.kde.kirigamiaddons.components as Components

Controls.ApplicationWindow {
    visible: true

    Components.MessageDialog {
        id: errorDialog

        dialogType: Components.MessageDialog.Error
        title: "Unable to connect"
        subtitle: "Check your network connection and try again."
        dontShowAgainName: "connectionError"
        standardButtons: Controls.Dialog.Ok
    }

    Controls.Button {
        text: "Show message"
        onClicked: errorDialog.openDialog()
    }
}

Call openDialog() to show the dialog and honor any saved choice. Set dontShowAgainName to offer a persistent "Do not show again" checkbox.

Property Documentation

[default: "Notification Messages"] configGroupName : string

The configuration group used to store the "Do not show again" choice.

[default: MessageDialog.Success] dialogType : int

Selects the message style and its default icon and title. It can be:

Constant Description
MessageDialog.Success For a success message.
MessageDialog.Warning For a warning message.
MessageDialog.Error For an error message.
MessageDialog.Information For an informational message.

[default: ""] dontShowAgainName : string

The configuration key used to store the "Do not show again" choice.

When this property is non-empty, a checkbox is shown for supported standard button combinations. The choice is saved in the application configuration under configGroupName.

Call openDialog() to show the dialog. A saved choice can suppress it and emit its corresponding result signal. A positive choice emits accepted() or applied(), depending on the button. A negative choice emits rejected() or discarded(). Accepted and rejected button actions close the dialog. A choice is remembered only when a supported result button is clicked. Cancel and dismissing the dialog do not save a preference. Supported combinations have exactly one positive button (Ok, Open, Save, Save All, Yes, Yes to All, Apply, Retry, or Ignore), at most one negative button (No, No to All, or Discard), and optionally Cancel, Close, or Abort. Other combinations open normally without the checkbox.

Warning: Replacing contentItem or footer, or setting header, is unsupported. The dialog logs an error if any of these properties is changed.

iconName : string

The name of the icon shown beside the message. By default, this is selected from dialogType. Set it to an empty string to hide the icon.

[default] mainContent : QtObject

The default property for additional content items. Child items appear below the title and subtitle. Do not replace the dialog's contentItem.

subtitle : string

The message text shown below the title. For additional content, add child items to the dialog.

Method Documentation

openDialog()

Open the dialog only if the user didn't check the "Do not remind me" checkbox previously. If a stored choice suppresses the dialog, its corresponding result signal is emitted instead.

AbstractButton standardButton(StandardButton button)

Returns the standard button matching button, or null if that button is not present in standardButtons.

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