MessageDialog QML Type

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

Import Statement: import org.kde.kirigamiaddons.components

Properties

Methods

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

configGroupName : string [default: "Notification Messages"]

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

dialogType : int [default: MessageDialog.Success]

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

ConstantDescription
MessageDialog.SuccessFor a success message.
MessageDialog.WarningFor a warning message.
MessageDialog.ErrorFor an error message.
MessageDialog.InformationFor an informational message.

dontShowAgainName : string [default: ""]

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.

mainContent : QtObject [default]

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.