Warning, /libraries/kirigami-addons/src/dateandtime/TimePopup.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu> 0002 // SPDX-License-Identifier: LGPL-2.0-or-later 0003 0004 import QtQuick 2.15 0005 import QtQuick.Layouts 1.15 0006 import QtQuick.Controls 2.15 as QQC2 0007 import org.kde.kirigami 2.20 as Kirigami 0008 import org.kde.kirigamiaddons.components 1.0 as Components 0009 0010 QQC2.Dialog { 0011 id: root 0012 0013 /** 0014 * @brief The current date and time selected by the user. 0015 */ 0016 property date value: new Date() 0017 0018 /** 0019 * Emitted when the user accepts the dialog. 0020 * The selected date is available from the selectedDate property. 0021 */ 0022 signal accepted() 0023 0024 /** 0025 * Emitted when the user cancells the popup 0026 */ 0027 signal cancelled() 0028 0029 property date _value: new Date() 0030 0031 modal: true 0032 0033 contentItem: TimePicker { 0034 id: popupContent 0035 implicitWidth: applicationWindow().width 0036 minutes: root.value.getMinutes() 0037 hours: root.value.getHours() 0038 onMinutesChanged: { 0039 root._value.setHours(hours, minutes); 0040 } 0041 onHoursChanged: { 0042 root._value.setHours(hours, minutes); 0043 } 0044 } 0045 0046 background: Components.DialogRoundedBackground {} 0047 0048 footer: Components.MessageDialogButtonBox { 0049 id: box 0050 0051 Components.MessageDialogButton { 0052 text: i18ndc("kirigami-addons6", "@action:button", "Cancel") 0053 icon.name: "dialog-cancel" 0054 buttonBox: box 0055 onClicked: { 0056 root.cancelled() 0057 root.close() 0058 } 0059 0060 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole 0061 } 0062 0063 Components.MessageDialogButton { 0064 text: i18ndc("kirigami-addons6", "@action:button", "Select") 0065 icon.name: "dialog-ok-apply" 0066 buttonBox: box 0067 onClicked: { 0068 root.value = root._value; 0069 root.accepted() 0070 root.close() 0071 } 0072 0073 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole 0074 } 0075 } 0076 0077 // black background, fades in and out 0078 QQC2.Overlay.modal: Rectangle { 0079 color: Qt.rgba(0, 0, 0, 0.3) 0080 0081 // the opacity of the item is changed internally by QQuickPopup on open/close 0082 Behavior on opacity { 0083 OpacityAnimator { 0084 duration: Kirigami.Units.longDuration 0085 easing.type: Easing.InOutQuad 0086 } 0087 } 0088 } 0089 }