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
 
alias dialogChildren
 
alias dialogData
 
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 standardButtons 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 the 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 the Dialog that target specific usecases, and can reduce boilerplate code if used:

See also
PromptDialog
MenuDialog

Definition at line 106 of file Dialog.qml.

Property Documentation

◆ absoluteMaximumHeight

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

This property sets the absolute maximum height the dialog can have.

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 139 of file Dialog.qml.

◆ absoluteMaximumWidth

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

This property holds the absolute maximum width the dialog can have.

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 147 of file Dialog.qml.

◆ dialogChildren

list< Item > Dialog::dialogChildren
read

This property holds the content items of the dialog.

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

Definition at line 127 of file Dialog.qml.

◆ dialogData

list< QtObject > Dialog::dialogData
read

This property holds the dialog's contents; includes Items and QtObjects.

Remarks
This is the default property

Definition at line 118 of file Dialog.qml.

◆ flatFooterButtons

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

This property sets whether the footer button style should be flat.

Definition at line 200 of file Dialog.qml.

◆ footerLeadingComponent

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

This property holds the component to the left of the footer buttons.

Definition at line 188 of file Dialog.qml.

◆ footerTrailingComponent

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

his property holds the component to the right of the footer buttons.

Definition at line 192 of file Dialog.qml.

◆ Kirigami

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

This property holds the custom actions displayed in the footer.

Example usage:

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
org::kde::kirigami::Action

Definition at line 231 of file Dialog.qml.

◆ mainItem

Item org::kde::kirigami::Dialog::mainItem
read
Deprecated:
This property will be removed in the next major frameworks release (KF6)

Definition at line 112 of file Dialog.qml.

◆ maximumHeight

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

This property holds the maximum height the dialog can have (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 158 of file Dialog.qml.

◆ maximumWidth

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

This property holds the maximum width the dialog can have.

By default, this is absoluteMaximumWidth.

Definition at line 164 of file Dialog.qml.

◆ preferredHeight

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

This property holds 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 174 of file Dialog.qml.

◆ preferredWidth

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

This property holds 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 184 of file Dialog.qml.

◆ showCloseButton

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

This property sets whether to show the close button in the header.

Definition at line 196 of file Dialog.qml.


The documentation for this class was generated from the following file:
Q_SCRIPTABLE Q_NOREPLY void start()
real preferredWidth
This property holds the preferred width of the dialog.
Definition: Dialog.qml:184
QString i18n(const char *text, const TYPE &arg...)
list Kirigami
This property holds the custom actions displayed in the footer.
Definition: Dialog.qml:231
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Dec 6 2022 04:10:11 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.