org::kde::kirigami::Dialog

Search for usage in LXR

org::kde::kirigami::Dialog Class Reference
Inheritance diagram for org::kde::kirigami::Dialog:

Properties

real absoluteMaximumHeight
 
real absoluteMaximumWidth
 
bool flatFooterButtons
 
Component footerLeadingComponent
 
Component footerTrailingComponent
 
list Kirigami
 
Item mainItem
 
real maximumHeight
 
real maximumWidth
 
real preferredHeight
 
real preferredWidth
 
bool showCloseButton
 

Public Member Functions

void standardButton (button)
 

Detailed Description

Popup dialog that is used for short tasks and user interaction.

Dialog consists of three components: the header, the content, and the footer.

By default, the header is a heading with text specified by the title property.

By default, the footer consists of a row of buttons specified by the footerActions and customFooterActions properties.

The implicitHeight and implicitWidth of the dialog contentItem is the primary hint used for the dialog size. The dialog will be the minimum size required for the header, footer and content unless it is larger than maximumHeight and maximumWidth. Use preferredHeight and preferredWidth in order to manually specify a size for the dialog.

If the content height exceeds the maximum height of the dialog, the dialog's contents will become scrollable.

If the contentItem is a ListView, the dialog will take care of the necessary scrollbars and scrolling behaviour. Do not attempt to nest ListViews (it must be the top level item), as the scrolling behaviour will not be handled. Use ListView's header and footer instead.

Example for a selection dialog:

import QtQuick 2.15
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.15 as Controls
import org.kde.kirigami 2.19 as Kirigami
Kirigami.Dialog {
title: i18n("Dialog")
padding: 0
preferredWidth: Kirigami.Units.gridUnit * 16
standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
onAccepted: console.log("OK button pressed")
onRejected: console.log("Rejected")
ColumnLayout {
spacing: 0
Repeater {
model: 5
delegate: Controls.CheckDelegate {
topPadding: Kirigami.Units.smallSpacing * 2
bottomPadding: Kirigami.Units.smallSpacing * 2
Layout.fillWidth: true
text: modelData
}
}
}
}

Example with scrolling (ListView scrolling behaviour is handled by Dialog):

Kirigami.Dialog {
id: scrollableDialog
title: i18n("Select Number")
ListView {
id: listView
// hints for the dialog dimensions
implicitWidth: Kirigami.Units.gridUnit * 16
implicitHeight: Kirigami.Units.gridUnit * 16
model: 100
delegate: Controls.RadioDelegate {
topPadding: Kirigami.Units.smallSpacing * 2
bottomPadding: Kirigami.Units.smallSpacing * 2
implicitWidth: listView.width
text: modelData
}
}
}

There are also sub-components of Dialog that target specific usecases, and can reduce boilerplate code if used:

See also
PromptDialog
MenuDialog

Definition at line 105 of file Dialog.qml.

Property Documentation

◆ absoluteMaximumHeight

real org::kde::kirigami::Dialog::absoluteMaximumHeight
read

The absolute maximum height the dialog can be (including the header and footer).

The height restriction is solely applied on the content, so if the maximum height given is not larger than the height of the header and footer, it will be ignored.

This is the window height, subtracted by largeSpacing on both the top and bottom.

Remarks
This property is read-only

Definition at line 127 of file Dialog.qml.

◆ absoluteMaximumWidth

real org::kde::kirigami::Dialog::absoluteMaximumWidth
read

The absolute maximum width the dialog can be.

By default, it is the window width, subtracted by largeSpacing on both the top and bottom.

Remarks
This property is read-only

Definition at line 135 of file Dialog.qml.

◆ flatFooterButtons

bool org::kde::kirigami::Dialog::flatFooterButtons
read

Whether or not the footer button style should be flat instead of raised.

Definition at line 188 of file Dialog.qml.

◆ footerLeadingComponent

Component org::kde::kirigami::Dialog::footerLeadingComponent
read

The component before the footer buttons.

Definition at line 176 of file Dialog.qml.

◆ footerTrailingComponent

Component org::kde::kirigami::Dialog::footerTrailingComponent
read

The component after the footer buttons.

Definition at line 180 of file Dialog.qml.

◆ Kirigami

list org::kde::kirigami::Dialog::Kirigami
read

Define a list of custom actions in the footer.

import QtQuick 2.15
import QtQuick.Controls 2.15 as Controls
import org.kde.kirigami 2.18 as Kirigami
Kirigami.PromptDialog {
id: dialog
title: i18n("Confirm Playback")
subtitle: i18n("Are you sure you want to play this song? It's really loud!")
standardButtons: Kirigami.Dialog.Cancel
customFooterActions: [
text: i18n("Play")
iconName: "media-playback-start"
onTriggered: {
//...
dialog.close();
}
}
]
}
See also
Action

Definition at line 218 of file Dialog.qml.

◆ mainItem

Item org::kde::kirigami::Dialog::mainItem
read

The dialog's contents.

The initial height and width of the dialog is calculated from the implicitWidth and implicitHeight of this item.

Remarks
This is the default property

Definition at line 114 of file Dialog.qml.

◆ maximumHeight

real org::kde::kirigami::Dialog::maximumHeight
read

The maximum height the dialog can be (including the header and footer).

The height restriction is solely enforced on the content, so if the maximum height given is not larger than the height of the header and footer, it will be ignored.

By default, this is absoluteMaximumHeight.

Definition at line 146 of file Dialog.qml.

◆ maximumWidth

real org::kde::kirigami::Dialog::maximumWidth
read

The maximum width the dialog can be.

By default, this is absoluteMaximumWidth.

Definition at line 152 of file Dialog.qml.

◆ preferredHeight

real org::kde::kirigami::Dialog::preferredHeight
read

Specify the preferred height of the dialog.

The content will receive a hint for how tall it should be to have the dialog to be this height.

If the content, header or footer require more space, then the height of the dialog will expand to the necessary amount of space.

Definition at line 162 of file Dialog.qml.

◆ preferredWidth

real org::kde::kirigami::Dialog::preferredWidth
read

Specify the preferred width of the dialog.

The content will receive a hint for how wide it should be to have the dialog be this wide.

If the content, header or footer require more space, then the width of the dialog will expand to the necessary amount of space.

Definition at line 172 of file Dialog.qml.

◆ showCloseButton

bool org::kde::kirigami::Dialog::showCloseButton
read

Whether or not to show the close button in the header.

Definition at line 184 of file Dialog.qml.


The documentation for this class was generated from the following file:
Q_SCRIPTABLE Q_NOREPLY void start()
real preferredWidth
Specify the preferred width of the dialog.
Definition: Dialog.qml:172
QString i18n(const char *text, const TYPE &arg...)
list Kirigami
Define a list of custom actions in the footer.
Definition: Dialog.qml:218
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Jun 27 2022 04:23:32 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.