Compare commits
2 Commits
858c72011a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| bd50bb84c2 | |||
| ad6cc066bc |
@@ -28,6 +28,7 @@ qt_add_qml_module(appProject-Orion
|
|||||||
QML_FILES CalendarGrid.qml
|
QML_FILES CalendarGrid.qml
|
||||||
QML_FILES UserConfiguration.qml
|
QML_FILES UserConfiguration.qml
|
||||||
QML_FILES DateRangeSelector.qml
|
QML_FILES DateRangeSelector.qml
|
||||||
|
QML_FILES DateRangeCell.qml
|
||||||
)
|
)
|
||||||
|
|
||||||
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
|
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
|
||||||
|
|||||||
37
src/Project-Orion/DateRangeCell.qml
Normal file
37
src/Project-Orion/DateRangeCell.qml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: repeatedRectangle
|
||||||
|
property bool isHoveredOver: false
|
||||||
|
|
||||||
|
border.color: isHoveredOver ? highlightColor: inactiveBackgroundColor
|
||||||
|
border.width: 3
|
||||||
|
width: rectangleWidth
|
||||||
|
height: 20
|
||||||
|
color: inactiveBackgroundColor
|
||||||
|
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: repeatedRectangle.isHoveredOver = true
|
||||||
|
onExited: repeatedRectangle.isHoveredOver = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
font.pixelSize: 12
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: myText
|
||||||
|
color: textColor
|
||||||
|
}
|
||||||
|
|
||||||
|
required property color highlightColor
|
||||||
|
required property color textColor
|
||||||
|
required property color activeBackgroundColor
|
||||||
|
required property color inactiveBackgroundColor
|
||||||
|
required property string myText
|
||||||
|
required property int rectangleWidth
|
||||||
|
}
|
||||||
@@ -3,28 +3,26 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
Dialog {
|
Dialog {
|
||||||
width: 300
|
width: 400
|
||||||
height: 300
|
height: 300
|
||||||
|
|
||||||
id: dateRangeRootDialog
|
id: dateRangeRootDialog
|
||||||
|
|
||||||
required property date currentDate
|
required property date currentDate
|
||||||
required property SystemPalette calendarActivePalette;
|
required property SystemPalette calendarActivePalette
|
||||||
required property color disabledTextColor;
|
required property color disabledTextColor
|
||||||
|
|
||||||
enum ViewMode
|
enum ViewMode {
|
||||||
{
|
|
||||||
DAY = 0,
|
DAY = 0,
|
||||||
MONTH = 1,
|
MONTH = 1,
|
||||||
YEAR = 2
|
YEAR = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
property int viewMode: Qt.enumStringToValue(DateRangeSelector.ViewMode, "DAY")
|
property int viewMode: 0
|
||||||
property date beginDate;
|
property date beginDate
|
||||||
property date endDate;
|
property date endDate
|
||||||
|
|
||||||
Flickable
|
Flickable {
|
||||||
{
|
|
||||||
onMovementStarted: console.log("Flick started")
|
onMovementStarted: console.log("Flick started")
|
||||||
onMovementEnded: console.log("Flick ended")
|
onMovementEnded: console.log("Flick ended")
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -33,69 +31,85 @@ Dialog {
|
|||||||
GridLayout {
|
GridLayout {
|
||||||
id: myGridLayout
|
id: myGridLayout
|
||||||
columns: 1
|
columns: 1
|
||||||
|
anchors.centerIn: parent
|
||||||
Label
|
Label {
|
||||||
{
|
|
||||||
font.pixelSize: 22
|
font.pixelSize: 22
|
||||||
text: getMyDate()
|
text: getMyDate()
|
||||||
}
|
}
|
||||||
|
|
||||||
DayOfWeekRow {
|
DayOfWeekRow {
|
||||||
visible: dateRangeRootDialog.viewMode === Qt.enumStringToValue(DateRangeSelector.ViewMode, "DAY")
|
visible: dateRangeRootDialog.viewMode === DateRangeSelector.ViewMode.DAY
|
||||||
locale: grid.locale
|
locale: grid.locale
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
MonthGrid
|
MonthGrid {
|
||||||
{
|
|
||||||
|
|
||||||
id: grid
|
id: grid
|
||||||
|
|
||||||
month: currentDate.getMonth()
|
month: currentDate.getMonth()
|
||||||
year: currentDate.getFullYear()
|
year: currentDate.getFullYear()
|
||||||
locale: Qt.locale("en_US")
|
locale: Qt.locale("en_US")
|
||||||
|
visible: dateRangeRootDialog.viewMode === DateRangeSelector.ViewMode.DAY
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
delegate: Rectangle {
|
delegate: Row {
|
||||||
border.color: model.day === currentDate.getDay() ? "green": "transparent"
|
DateRangeCell {
|
||||||
border.width: 3
|
inactiveBackgroundColor: calendarActivePalette ? calendarActivePalette.base : "black"
|
||||||
width: 30
|
activeBackgroundColor: calendarActivePalette ? calendarActivePalette.highlight : "yellow"
|
||||||
height: 20
|
highlightColor: calendarActivePalette ? calendarActivePalette.highlight : "yellow"
|
||||||
color: calendarActivePalette.base
|
myText: model.day
|
||||||
|
rectangleWidth: 30
|
||||||
|
textColor: calendarActivePalette ? (model.month === currentDate.getMonth(
|
||||||
Text {
|
) ? calendarActivePalette.text : calendarActivePalette.dark) : "black"
|
||||||
anchors.centerIn: parent
|
|
||||||
font.pixelSize: 12
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: model.day
|
|
||||||
color: model.month === currentDate.getMonth() ? calendarActivePalette.text : disabledTextColor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
required property var model
|
required property var model
|
||||||
}
|
}
|
||||||
|
|
||||||
property date currentlySelectedDate: currentDate;
|
property date currentlySelectedDate: currentDate
|
||||||
}
|
}
|
||||||
Row
|
|
||||||
{
|
Grid {
|
||||||
Button
|
id: monthsGrid
|
||||||
{
|
visible: dateRangeRootDialog.viewMode === DateRangeSelector.ViewMode.MONTH
|
||||||
|
spacing: 15
|
||||||
|
columns: 3
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: 12
|
||||||
|
|
||||||
|
DateRangeCell {
|
||||||
|
property list<string> monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
|
||||||
|
|
||||||
|
inactiveBackgroundColor: calendarActivePalette ? calendarActivePalette.base : "black"
|
||||||
|
activeBackgroundColor: calendarActivePalette ? calendarActivePalette.highlight : "yellow"
|
||||||
|
highlightColor: calendarActivePalette ? calendarActivePalette.highlight : "yellow"
|
||||||
|
myText: monthNames[index]
|
||||||
|
textColor: calendarActivePalette ? calendarActivePalette.text : "black"
|
||||||
|
rectangleWidth: 60
|
||||||
|
|
||||||
|
required property int index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
Button {
|
||||||
text: "Months"
|
text: "Months"
|
||||||
|
|
||||||
|
onPressed: dateRangeRootDialog.viewMode = DateRangeSelector.ViewMode.MONTH
|
||||||
}
|
}
|
||||||
|
|
||||||
Button
|
Button {
|
||||||
{
|
|
||||||
text: "Years"
|
text: "Years"
|
||||||
|
onPressed: dateRangeRootDialog.viewMode = DateRangeSelector.ViewMode.MONTH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMyDate()
|
function getMyDate() {
|
||||||
{
|
return Qt.formatDateTime(currentDate, "MMM yyyy")
|
||||||
return Qt.formatDateTime(currentDate, "MMM yyyy");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||||
|
|||||||
Reference in New Issue
Block a user