mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-30 07:03:46 +08:00
update
This commit is contained in:
parent
b254064e26
commit
4c9e576072
@ -23,6 +23,9 @@ FluScrollablePage{
|
|||||||
text:"showYear=true"
|
text:"showYear=true"
|
||||||
}
|
}
|
||||||
FluDatePicker{
|
FluDatePicker{
|
||||||
|
onCurrentChanged: {
|
||||||
|
showSuccess(current.toLocaleDateString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,7 +53,9 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluDatePicker{
|
FluDatePicker{
|
||||||
showYear:false
|
showYear:false
|
||||||
|
onCurrentChanged: {
|
||||||
|
showSuccess(current.toLocaleDateString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,9 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluTimePicker{
|
FluTimePicker{
|
||||||
|
onCurrentChanged: {
|
||||||
|
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -53,11 +56,14 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:"hourFormat=FluTimePicker.H"
|
text:"hourFormat=FluTimePicker.HH"
|
||||||
}
|
}
|
||||||
|
|
||||||
FluTimePicker{
|
FluTimePicker{
|
||||||
hourFormat:FluTimePicker.HH
|
hourFormat:FluTimePicker.HH
|
||||||
|
onCurrentChanged: {
|
||||||
|
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,9 @@ Rectangle {
|
|||||||
property color dividerColor: FluTheme.dark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
|
property color dividerColor: FluTheme.dark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
|
||||||
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||||
property var window : Window.window
|
|
||||||
property bool showYear: true
|
property bool showYear: true
|
||||||
property bool changeFlag: true
|
property var current
|
||||||
readonly property var rowData: ["","",""]
|
id:control
|
||||||
id:root
|
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
return hoverColor
|
return hoverColor
|
||||||
@ -24,6 +22,13 @@ Rectangle {
|
|||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: dividerColor
|
border.color: dividerColor
|
||||||
|
Item{
|
||||||
|
id:d
|
||||||
|
property var window: Window.window
|
||||||
|
property bool changeFlag: true
|
||||||
|
property var rowData: ["","",""]
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:mouse_area
|
id:mouse_area
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
@ -317,8 +322,19 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
text: "确定"
|
text: "确定"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
changeFlag = false
|
d.changeFlag = false
|
||||||
popup.close()
|
popup.close()
|
||||||
|
const year = text_year.text
|
||||||
|
const month = text_month.text
|
||||||
|
const day = text_day.text
|
||||||
|
const date = new Date()
|
||||||
|
date.setFullYear(parseInt(year));
|
||||||
|
date.setMonth(parseInt(month) - 1);
|
||||||
|
date.setDate(parseInt(day));
|
||||||
|
date.setHours(0);
|
||||||
|
date.setMinutes(0);
|
||||||
|
date.setSeconds(0);
|
||||||
|
current = date
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,10 +342,10 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
y:35
|
y:35
|
||||||
function showPopup() {
|
function showPopup() {
|
||||||
changeFlag = true
|
d.changeFlag = true
|
||||||
rowData[0] = text_year.text
|
d.rowData[0] = text_year.text
|
||||||
rowData[1] = text_month.text
|
d.rowData[1] = text_month.text
|
||||||
rowData[2] = text_day.text
|
d.rowData[2] = text_day.text
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
|
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
|
||||||
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.text);
|
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.text);
|
||||||
@ -342,21 +358,21 @@ Rectangle {
|
|||||||
list_view_3.model = generateMonthDaysArray(year,month)
|
list_view_3.model = generateMonthDaysArray(year,month)
|
||||||
list_view_3.currentIndex = list_view_3.model.indexOf(day)
|
list_view_3.currentIndex = list_view_3.model.indexOf(day)
|
||||||
text_day.text = day
|
text_day.text = day
|
||||||
var pos = root.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
if(window.height>pos.y+root.height+container.height){
|
if(d.window.height>pos.y+control.height+container.height){
|
||||||
popup.y = root.height
|
popup.y = control.height
|
||||||
} else if(pos.y>container.height){
|
} else if(pos.y>container.height){
|
||||||
popup.y = -container.height
|
popup.y = -container.height
|
||||||
} else {
|
} else {
|
||||||
popup.y = window.height-(pos.y+container.height)
|
popup.y = d.window.height-(pos.y+container.height)
|
||||||
}
|
}
|
||||||
popup.open()
|
popup.open()
|
||||||
}
|
}
|
||||||
onClosed: {
|
onClosed: {
|
||||||
if(changeFlag){
|
if(d.changeFlag){
|
||||||
text_year.text = rowData[0]
|
text_year.text = d.rowData[0]
|
||||||
text_month.text = rowData[1]
|
text_month.text = d.rowData[1]
|
||||||
text_day.text = rowData[2]
|
text_day.text = d.rowData[2]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@ Rectangle {
|
|||||||
property color dividerColor: FluTheme.dark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
|
property color dividerColor: FluTheme.dark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
|
||||||
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||||
property var window : Window.window
|
|
||||||
property int hourFormat: FluTimePicker.H
|
property int hourFormat: FluTimePicker.H
|
||||||
property int isH: hourFormat === FluTimePicker.H
|
property int isH: hourFormat === FluTimePicker.H
|
||||||
id:root
|
property var current
|
||||||
|
id:control
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
return hoverColor
|
return hoverColor
|
||||||
@ -27,6 +27,13 @@ Rectangle {
|
|||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: dividerColor
|
border.color: dividerColor
|
||||||
|
Item{
|
||||||
|
id:d
|
||||||
|
property var window: Window.window
|
||||||
|
property bool changeFlag: true
|
||||||
|
property var rowData: ["","",""]
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:mouse_area
|
id:mouse_area
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
@ -312,8 +319,24 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
text: "确定"
|
text: "确定"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
changeFlag = false
|
d.changeFlag = false
|
||||||
popup.close()
|
popup.close()
|
||||||
|
const hours = text_hour.text
|
||||||
|
const minutes = text_minute.text
|
||||||
|
const period = text_ampm.text
|
||||||
|
const date = new Date()
|
||||||
|
var hours24 = parseInt(hours);
|
||||||
|
if(control.hourFormat === FluTimePicker.H){
|
||||||
|
if (hours === "12") {
|
||||||
|
hours24 = (period === "上午") ? 0 : 12;
|
||||||
|
} else {
|
||||||
|
hours24 = (period === "上午") ? hours24 : hours24 + 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
date.setHours(hours24);
|
||||||
|
date.setMinutes(parseInt(minutes));
|
||||||
|
date.setSeconds(0);
|
||||||
|
current = date
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,10 +344,10 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
y:35
|
y:35
|
||||||
function showPopup() {
|
function showPopup() {
|
||||||
changeFlag = true
|
d.changeFlag = true
|
||||||
rowData[0] = text_hour.text
|
d.rowData[0] = text_hour.text
|
||||||
rowData[1] = text_minute.text
|
d.rowData[1] = text_minute.text
|
||||||
rowData[2] = text_ampm.text
|
d.rowData[2] = text_ampm.text
|
||||||
|
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
|
|
||||||
@ -353,27 +376,24 @@ Rectangle {
|
|||||||
if(isH){
|
if(isH){
|
||||||
text_ampm.text = ampm
|
text_ampm.text = ampm
|
||||||
}
|
}
|
||||||
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
var pos = root.mapToItem(null, 0, 0)
|
if(d.window.height>pos.y+control.height+container.height){
|
||||||
if(window.height>pos.y+root.height+container.height){
|
popup.y = control.height
|
||||||
popup.y = root.height
|
|
||||||
} else if(pos.y>container.height){
|
} else if(pos.y>container.height){
|
||||||
popup.y = -container.height
|
popup.y = -container.height
|
||||||
} else {
|
} else {
|
||||||
popup.y = window.height-(pos.y+container.height)
|
popup.y = d.window.height-(pos.y+container.height)
|
||||||
}
|
}
|
||||||
popup.open()
|
popup.open()
|
||||||
}
|
}
|
||||||
onClosed: {
|
onClosed: {
|
||||||
if(changeFlag){
|
if(d.changeFlag){
|
||||||
text_hour.text = rowData[0]
|
text_hour.text = d.rowData[0]
|
||||||
text_minute.text = rowData[1]
|
text_minute.text = d.rowData[1]
|
||||||
text_ampm.text = rowData[2]
|
text_ampm.text = d.rowData[2]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
property bool changeFlag: true
|
|
||||||
readonly property var rowData: ["","",""]
|
|
||||||
function generateArray(start, n) {
|
function generateArray(start, n) {
|
||||||
var arr = [];
|
var arr = [];
|
||||||
for (var i = start; i <= n; i++) {
|
for (var i = start; i <= n; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user