MauiKit Controls

Notification.qml
1// Copyright 2018-2020 Camilo Higuita <milo.h@aol.com>
2// Copyright 2018-2020 Nitrux Latinoamericana S.C.
3//
4// SPDX-License-Identifier: GPL-3.0-or-later
5
6import QtQuick
7import QtCore
8import QtQuick.Controls
9
10import org.mauikit.controls as Maui
11
12/**
13 * @inherit QtObject
14 * @brief A wrapper for easily composing a notification that can be dispatched.
15 * The notification is dispatched to the current application window overlay area.
16 * @image html controls_notification.png "Multiple notifications. Different types, with callback actions, only simple text, or more complex."
17 *
18 * By default this control will take QQC2 Action as children. For showing the notification just call the function `dispatch`
19 *
20 * @code
21 * Maui.Notification
22 * {
23 * iconName: "dialog-info"
24 * title: i18n("Tagged")
25 * message: i18n("File was tagged successfully")
26 *
27 * Action
28 * {
29 * text: "Test"
30 * onTriggered:
31 * {
32 * }
33 * }
34 * }
35 * @endcode
36 */
37QtObject
38{
39 id: control
41 /*
42 * @brief A set of callback actions to be listed in the notification popup
43 */
44 default property list<Action> actions : []
45
46 /**
47 * @brief The title for the notification
48 */
49 property string title
50
51 /**
52 * @brief The body message of the notification
53 */
54 property string message
55
56 /**
57 * @brief The icon from a file source, such as an image to be used
58 */
59 property string iconSource
61 /**
62 * @brief The name of the icon to be used
63 */
64 property string iconName
65
66 /**
67 * Sends the notification to the toast-area to be visible.
68 */
69 function dispatch()
70 {
71 Maui.App.rootComponent.notify(control.iconName, control.title, control.message, control.actions)
72 }
73}
string iconSource
The icon from a file source, such as an image to be used.
list< Action > actions
string title
The title for the notification.
void dispatch()
Sends the notification to the toast-area to be visible.
string iconName
The name of the icon to be used.
string message
The body message of the notification.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 25 2025 11:53:32 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.