Warning, /libraries/kirigami-addons/tests/datetime.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.5
0008 import QtQuick.Layouts 1.1
0009 import QtQuick.Controls 2.1 as QQC2
0010 import org.kde.kirigami 2.5 as Kirigami
0011 import org.kde.kirigamiaddons.dateandtime 0.1 as Addon
0012 
0013 Kirigami.ApplicationWindow {
0014     title: "Date & Time Test"
0015     pageStack.initialPage: dateTimePage
0016 
0017     Component {
0018         id: dateTimePage
0019         Kirigami.Page {
0020             Kirigami.FormLayout {
0021                 anchors.fill: parent
0022                 Addon.DateInput {
0023                     id: dateInput
0024                     Kirigami.FormData.label: "Date"
0025                     onSelectedDateChanged: console.log(selectedDate)
0026                 }
0027 
0028                 QQC2.Button {
0029                     text: "set to now"
0030                     onClicked: dateInput.selectedDate = new Date()
0031                 }
0032 
0033                 Addon.TimeInput {
0034                     id: timeInput
0035                     Kirigami.FormData.label: "Time"
0036                     onValueChanged: console.log(value)
0037                 }
0038 
0039                 QQC2.Button {
0040                     text: "Set to now"
0041                     onClicked: {
0042                         timeInput.value = new Date();
0043                     }
0044                 }
0045 
0046                 Addon.ClockFace {
0047                     implicitWidth: 400
0048                     implicitHeight: implicitWidth
0049                     time: timeInput.value
0050                 }
0051             }
0052         }
0053     }
0054 }