/* * This file is part of the Flowee project * Copyright (C) 2025 Tom Zander * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ import QtQuick import "../Flowee" as Flowee Flow { id: root property date date; property date selectedDate; property alias text: mainLabel.text spacing: 6 Flowee.Label { id: mainLabel height: Math.max(50, contentHeight + 10) verticalAlignment: Text.AlignVCenter MouseArea { width: root.width + 10 height: parent.height x: -5 onClicked: dateTimeDialog.start() } } Flowee.Label { text: { var d = root.date if (isNaN(d)) return qsTr("None") return Pay.formatDate(d) } height: Math.max(50, contentHeight + 10) verticalAlignment: Text.AlignVCenter Flowee.Dialog { id: dateTimeDialog property var selectedDate: null; function start() { selectedDate = root.date open(); } contentComponent: CalendarWidget { onSelectedChanged: dateTimeDialog.selectedDate = selected; oldCutoff: new Date() // today. To avoid selecting a date in the past onVisibleChanged: { if (visible) selected = dateTimeDialog.selectedDate } } onAccepted: root.selectedDate = selectedDate } } }