mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-27 05:38:37 +08:00
update
This commit is contained in:
parent
a1199a9e9c
commit
ba565e1ee8
@ -36,6 +36,10 @@ FluScrollablePage{
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
FluCalendarPicker{
|
FluCalendarPicker{
|
||||||
|
current:Date.fromLocaleString("2013年7月11日 21:17:42")
|
||||||
|
onAccepted:{
|
||||||
|
showSuccess(current.toLocaleString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,8 @@ FluScrollablePage{
|
|||||||
text:"showYear=true"
|
text:"showYear=true"
|
||||||
}
|
}
|
||||||
FluDatePicker{
|
FluDatePicker{
|
||||||
onCurrentChanged: {
|
current: new Date()
|
||||||
|
onAccepted: {
|
||||||
showSuccess(current.toLocaleDateString())
|
showSuccess(current.toLocaleDateString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,10 +51,9 @@ FluScrollablePage{
|
|||||||
FluText{
|
FluText{
|
||||||
text:"showYear=false"
|
text:"showYear=false"
|
||||||
}
|
}
|
||||||
|
|
||||||
FluDatePicker{
|
FluDatePicker{
|
||||||
showYear:false
|
showYear:false
|
||||||
onCurrentChanged: {
|
onAccepted: {
|
||||||
showSuccess(current.toLocaleDateString())
|
showSuccess(current.toLocaleDateString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,8 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluTimePicker{
|
FluTimePicker{
|
||||||
onCurrentChanged: {
|
current: new Date()
|
||||||
|
onAccepted: {
|
||||||
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,7 +62,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluTimePicker{
|
FluTimePicker{
|
||||||
hourFormat:FluTimePickerType.HH
|
hourFormat:FluTimePickerType.HH
|
||||||
onCurrentChanged: {
|
onAccepted: {
|
||||||
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,10 @@ FluScrollablePage{
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
FluCalendarPicker{
|
FluCalendarPicker{
|
||||||
|
current:Date.fromLocaleString("2013年7月11日 21:17:42")
|
||||||
|
onAccepted:{
|
||||||
|
showSuccess(current.toLocaleString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,8 @@ FluScrollablePage{
|
|||||||
text:"showYear=true"
|
text:"showYear=true"
|
||||||
}
|
}
|
||||||
FluDatePicker{
|
FluDatePicker{
|
||||||
onCurrentChanged: {
|
current: new Date()
|
||||||
|
onAccepted: {
|
||||||
showSuccess(current.toLocaleDateString())
|
showSuccess(current.toLocaleDateString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,10 +51,9 @@ FluScrollablePage{
|
|||||||
FluText{
|
FluText{
|
||||||
text:"showYear=false"
|
text:"showYear=false"
|
||||||
}
|
}
|
||||||
|
|
||||||
FluDatePicker{
|
FluDatePicker{
|
||||||
showYear:false
|
showYear:false
|
||||||
onCurrentChanged: {
|
onAccepted: {
|
||||||
showSuccess(current.toLocaleDateString())
|
showSuccess(current.toLocaleDateString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ FluScrollablePage{
|
|||||||
id: bg
|
id: bg
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
asynchronous: true
|
||||||
verticalAlignment: Qt.AlignTop
|
verticalAlignment: Qt.AlignTop
|
||||||
source: "qrc:/example/res/image/bg_home_header.png"
|
source: "qrc:/example/res/image/bg_home_header.png"
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,8 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluTimePicker{
|
FluTimePicker{
|
||||||
onCurrentChanged: {
|
current: new Date()
|
||||||
|
onAccepted: {
|
||||||
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,7 +62,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluTimePicker{
|
FluTimePicker{
|
||||||
hourFormat:FluTimePickerType.HH
|
hourFormat:FluTimePickerType.HH
|
||||||
onCurrentChanged: {
|
onAccepted: {
|
||||||
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ Rectangle {
|
|||||||
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 string text: "请选择日期"
|
property string text: "请选择日期"
|
||||||
|
property var current
|
||||||
|
signal accepted()
|
||||||
id:control
|
id:control
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
@ -21,6 +23,17 @@ Rectangle {
|
|||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: dividerColor
|
border.color: dividerColor
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if(current){
|
||||||
|
const date = current
|
||||||
|
var year = date.getFullYear()
|
||||||
|
var month = date.getMonth()
|
||||||
|
var day = date.getDate()
|
||||||
|
text_date.text = year+"-"+(month+1)+"-"+day
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:mouse_area
|
id:mouse_area
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
@ -90,6 +103,8 @@ Rectangle {
|
|||||||
var month = date.getMonth()
|
var month = date.getMonth()
|
||||||
var day = date.getDate()
|
var day = date.getDate()
|
||||||
text_date.text = year+"-"+(month+1)+"-"+day
|
text_date.text = year+"-"+(month+1)+"-"+day
|
||||||
|
current= date
|
||||||
|
control.accepted()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,6 +114,9 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function showPopup() {
|
function showPopup() {
|
||||||
|
container.currentDate = current
|
||||||
|
container.date = current
|
||||||
|
container.updateMouth(current)
|
||||||
var pos = control.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
if(d.window.height>pos.y+control.height+container.height){
|
if(d.window.height>pos.y+control.height+container.height){
|
||||||
popup.y = control.height
|
popup.y = control.height
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
import QtQuick.Window 2.15
|
||||||
import FluentUI 1.0
|
import FluentUI 1.0
|
||||||
import QtQuick.Templates 2.15 as T
|
import QtQuick.Templates 2.15 as T
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ Rectangle {
|
|||||||
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 bool showYear: true
|
property bool showYear: true
|
||||||
property var current
|
property var current
|
||||||
|
signal accepted()
|
||||||
id:control
|
id:control
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
@ -22,6 +23,17 @@ Rectangle {
|
|||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: dividerColor
|
border.color: dividerColor
|
||||||
|
Component.onCompleted: {
|
||||||
|
if(current){
|
||||||
|
const now = current;
|
||||||
|
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
|
||||||
|
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.text);
|
||||||
|
var day = text_day.text === "日" ? now.getDate() : Number(text_day.text);
|
||||||
|
text_year.text = year
|
||||||
|
text_month.text = month
|
||||||
|
text_day.text = day
|
||||||
|
}
|
||||||
|
}
|
||||||
Item{
|
Item{
|
||||||
id:d
|
id:d
|
||||||
property var window: Window.window
|
property var window: Window.window
|
||||||
@ -335,6 +347,7 @@ Rectangle {
|
|||||||
date.setMinutes(0);
|
date.setMinutes(0);
|
||||||
date.setSeconds(0);
|
date.setSeconds(0);
|
||||||
current = date
|
current = date
|
||||||
|
control.accepted()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ Item{
|
|||||||
Component{
|
Component{
|
||||||
id:com_screen
|
id:com_screen
|
||||||
Window{
|
Window{
|
||||||
property bool isZeroPos: screenshot.start === Qt.point(0,0) && screenshot.end === Qt.point(0,0)
|
property bool isZeroPos: screenshot.start == Qt.point(0,0) && screenshot.end == Qt.point(0,0)
|
||||||
id:window_screen
|
id:window_screen
|
||||||
flags: Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint
|
flags: Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint
|
||||||
x:-1
|
x:-1
|
||||||
|
@ -35,9 +35,8 @@ Rectangle {
|
|||||||
property int defaultItemHeight: 42
|
property int defaultItemHeight: 42
|
||||||
property var header_rows:[]
|
property var header_rows:[]
|
||||||
property bool selectionFlag: true
|
property bool selectionFlag: true
|
||||||
function obtEditDelegate(column,row){
|
function obtEditDelegate(column,row,cellItem){
|
||||||
var display = table_model.data(table_model.index(row,column),"display")
|
var display = table_model.data(table_model.index(row,column),"display")
|
||||||
var cellItem = table_view.itemAtCell(column, row)
|
|
||||||
var cellPosition = cellItem.mapToItem(scroll_table, 0, 0)
|
var cellPosition = cellItem.mapToItem(scroll_table, 0, 0)
|
||||||
item_loader.column = column
|
item_loader.column = column
|
||||||
item_loader.row = row
|
item_loader.row = row
|
||||||
@ -223,7 +222,7 @@ Rectangle {
|
|||||||
clip: true
|
clip: true
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
id:item_table
|
id:item_table
|
||||||
property var position: Qt.point(column,row)
|
property point position: Qt.point(column,row)
|
||||||
color: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
|
color: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
implicitWidth: {
|
implicitWidth: {
|
||||||
@ -246,19 +245,16 @@ Rectangle {
|
|||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
onPressed:{
|
onPressed:{
|
||||||
closeEditor()
|
closeEditor()
|
||||||
table_view.interactive = false
|
|
||||||
}
|
}
|
||||||
onCanceled: {
|
onCanceled: {
|
||||||
table_view.interactive = true
|
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: {
|
||||||
table_view.interactive = true
|
|
||||||
}
|
}
|
||||||
onDoubleClicked:{
|
onDoubleClicked:{
|
||||||
if(display instanceof Component){
|
if(display instanceof Component){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
item_loader.sourceComponent = d.obtEditDelegate(column,row)
|
item_loader.sourceComponent = d.obtEditDelegate(column,row,item_table)
|
||||||
}
|
}
|
||||||
onClicked:
|
onClicked:
|
||||||
(event)=>{
|
(event)=>{
|
||||||
|
@ -11,6 +11,7 @@ FluMenu{
|
|||||||
id:menu
|
id:menu
|
||||||
enableAnimation: false
|
enableAnimation: false
|
||||||
width: 120
|
width: 120
|
||||||
|
focus: false
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
inputItem.forceActiveFocus()
|
inputItem.forceActiveFocus()
|
||||||
}
|
}
|
||||||
@ -19,33 +20,58 @@ FluMenu{
|
|||||||
function onTextChanged() {
|
function onTextChanged() {
|
||||||
menu.close()
|
menu.close()
|
||||||
}
|
}
|
||||||
|
function onActiveFocusChanged() {
|
||||||
|
if(!inputItem.activeFocus){
|
||||||
|
menu.close()
|
||||||
}
|
}
|
||||||
FluMenuItem{
|
}
|
||||||
|
}
|
||||||
|
FluIconButton{
|
||||||
|
display: Button.TextOnly
|
||||||
text:cutText
|
text:cutText
|
||||||
|
focus: false
|
||||||
|
padding: 0
|
||||||
|
height: visible ? 34 : 0
|
||||||
visible: inputItem.selectedText !== "" && !inputItem.readOnly
|
visible: inputItem.selectedText !== "" && !inputItem.readOnly
|
||||||
onClicked: {
|
onClicked: {
|
||||||
inputItem.cut()
|
inputItem.cut()
|
||||||
|
menu.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluMenuItem{
|
FluIconButton{
|
||||||
|
display: Button.TextOnly
|
||||||
text:copyText
|
text:copyText
|
||||||
|
focus: false
|
||||||
|
padding: 0
|
||||||
|
height: visible ? 34 : 0
|
||||||
visible: inputItem.selectedText !== ""
|
visible: inputItem.selectedText !== ""
|
||||||
onClicked: {
|
onClicked: {
|
||||||
inputItem.copy()
|
inputItem.copy()
|
||||||
|
menu.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluMenuItem{
|
FluIconButton{
|
||||||
|
display: Button.TextOnly
|
||||||
text:pasteText
|
text:pasteText
|
||||||
|
focus: false
|
||||||
|
padding: 0
|
||||||
|
height: visible ? 34 : 0
|
||||||
visible: inputItem.canPaste
|
visible: inputItem.canPaste
|
||||||
onClicked: {
|
onClicked: {
|
||||||
inputItem.paste()
|
inputItem.paste()
|
||||||
|
menu.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluMenuItem{
|
FluIconButton{
|
||||||
|
display: Button.TextOnly
|
||||||
text:selectAllText
|
text:selectAllText
|
||||||
|
focus: false
|
||||||
|
padding: 0
|
||||||
|
height: visible ? 34 : 0
|
||||||
visible: inputItem.text !== ""
|
visible: inputItem.text !== ""
|
||||||
onClicked: {
|
onClicked: {
|
||||||
inputItem.selectAll()
|
inputItem.selectAll()
|
||||||
|
menu.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ Rectangle {
|
|||||||
property int hourFormat: FluTimePickerType.H
|
property int hourFormat: FluTimePickerType.H
|
||||||
property int isH: hourFormat === FluTimePickerType.H
|
property int isH: hourFormat === FluTimePickerType.H
|
||||||
property var current
|
property var current
|
||||||
|
signal accepted()
|
||||||
id:control
|
id:control
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
@ -23,12 +24,40 @@ Rectangle {
|
|||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: dividerColor
|
border.color: dividerColor
|
||||||
|
Component.onCompleted: {
|
||||||
|
if(current){
|
||||||
|
var now = current;
|
||||||
|
var hour
|
||||||
|
var ampm;
|
||||||
|
if(isH){
|
||||||
|
hour = now.getHours();
|
||||||
|
if(hour>12){
|
||||||
|
ampm = "下午"
|
||||||
|
hour = hour-12
|
||||||
|
}else{
|
||||||
|
ampm = "上午"
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
hour = now.getHours();
|
||||||
|
}
|
||||||
|
hour = text_hour.text === "时"? hour.toString().padStart(2, '0') : text_hour.text
|
||||||
|
var minute = text_minute.text === "分"? now.getMinutes().toString().padStart(2, '0') : text_minute.text
|
||||||
|
ampm = text_ampm.text === "AM/PM"?ampm:text_ampm.text
|
||||||
|
text_hour.text = hour
|
||||||
|
text_minute.text = minute
|
||||||
|
if(isH){
|
||||||
|
text_ampm.text = ampm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Item{
|
Item{
|
||||||
id:d
|
id:d
|
||||||
property var window: Window.window
|
property var window: Window.window
|
||||||
property bool changeFlag: true
|
property bool changeFlag: true
|
||||||
property var rowData: ["","",""]
|
property var rowData: ["","",""]
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:mouse_area
|
id:mouse_area
|
||||||
@ -333,6 +362,7 @@ Rectangle {
|
|||||||
date.setMinutes(parseInt(minutes));
|
date.setMinutes(parseInt(minutes));
|
||||||
date.setSeconds(0);
|
date.setSeconds(0);
|
||||||
current = date
|
current = date
|
||||||
|
control.accepted()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -344,9 +374,7 @@ Rectangle {
|
|||||||
d.rowData[0] = text_hour.text
|
d.rowData[0] = text_hour.text
|
||||||
d.rowData[1] = text_minute.text
|
d.rowData[1] = text_minute.text
|
||||||
d.rowData[2] = text_ampm.text
|
d.rowData[2] = text_ampm.text
|
||||||
|
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
|
|
||||||
var hour
|
var hour
|
||||||
var ampm;
|
var ampm;
|
||||||
if(isH){
|
if(isH){
|
||||||
@ -366,7 +394,6 @@ Rectangle {
|
|||||||
list_view_1.currentIndex = list_view_1.model.indexOf(hour);
|
list_view_1.currentIndex = list_view_1.model.indexOf(hour);
|
||||||
list_view_2.currentIndex = list_view_2.model.indexOf(minute);
|
list_view_2.currentIndex = list_view_2.model.indexOf(minute);
|
||||||
list_view_3.currentIndex = list_view_3.model.indexOf(ampm);
|
list_view_3.currentIndex = list_view_3.model.indexOf(ampm);
|
||||||
|
|
||||||
text_hour.text = hour
|
text_hour.text = hour
|
||||||
text_minute.text = minute
|
text_minute.text = minute
|
||||||
if(isH){
|
if(isH){
|
||||||
@ -398,3 +425,4 @@ Rectangle {
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@ Rectangle {
|
|||||||
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 string text: "请选择日期"
|
property string text: "请选择日期"
|
||||||
|
property var current
|
||||||
|
signal accepted()
|
||||||
id:control
|
id:control
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
@ -21,6 +23,17 @@ Rectangle {
|
|||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: dividerColor
|
border.color: dividerColor
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if(current){
|
||||||
|
const date = current
|
||||||
|
var year = date.getFullYear()
|
||||||
|
var month = date.getMonth()
|
||||||
|
var day = date.getDate()
|
||||||
|
text_date.text = year+"-"+(month+1)+"-"+day
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:mouse_area
|
id:mouse_area
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
@ -90,6 +103,8 @@ Rectangle {
|
|||||||
var month = date.getMonth()
|
var month = date.getMonth()
|
||||||
var day = date.getDate()
|
var day = date.getDate()
|
||||||
text_date.text = year+"-"+(month+1)+"-"+day
|
text_date.text = year+"-"+(month+1)+"-"+day
|
||||||
|
current= date
|
||||||
|
control.accepted()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,6 +114,9 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function showPopup() {
|
function showPopup() {
|
||||||
|
container.currentDate = current
|
||||||
|
container.date = current
|
||||||
|
container.updateMouth(current)
|
||||||
var pos = control.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
if(d.window.height>pos.y+control.height+container.height){
|
if(d.window.height>pos.y+control.height+container.height){
|
||||||
popup.y = control.height
|
popup.y = control.height
|
||||||
|
@ -10,6 +10,7 @@ Rectangle {
|
|||||||
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 bool showYear: true
|
property bool showYear: true
|
||||||
property var current
|
property var current
|
||||||
|
signal accepted()
|
||||||
id:control
|
id:control
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
@ -22,6 +23,17 @@ Rectangle {
|
|||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: dividerColor
|
border.color: dividerColor
|
||||||
|
Component.onCompleted: {
|
||||||
|
if(current){
|
||||||
|
const now = current;
|
||||||
|
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
|
||||||
|
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.text);
|
||||||
|
var day = text_day.text === "日" ? now.getDate() : Number(text_day.text);
|
||||||
|
text_year.text = year
|
||||||
|
text_month.text = month
|
||||||
|
text_day.text = day
|
||||||
|
}
|
||||||
|
}
|
||||||
Item{
|
Item{
|
||||||
id:d
|
id:d
|
||||||
property var window: Window.window
|
property var window: Window.window
|
||||||
@ -335,6 +347,7 @@ Rectangle {
|
|||||||
date.setMinutes(0);
|
date.setMinutes(0);
|
||||||
date.setSeconds(0);
|
date.setSeconds(0);
|
||||||
current = date
|
current = date
|
||||||
|
control.accepted()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ FluMenu{
|
|||||||
id:menu
|
id:menu
|
||||||
enableAnimation: false
|
enableAnimation: false
|
||||||
width: 120
|
width: 120
|
||||||
|
focus: false
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
inputItem.forceActiveFocus()
|
inputItem.forceActiveFocus()
|
||||||
}
|
}
|
||||||
@ -19,33 +20,59 @@ FluMenu{
|
|||||||
function onTextChanged() {
|
function onTextChanged() {
|
||||||
menu.close()
|
menu.close()
|
||||||
}
|
}
|
||||||
|
function onActiveFocusChanged() {
|
||||||
|
if(!inputItem.activeFocus){
|
||||||
|
menu.close()
|
||||||
}
|
}
|
||||||
FluMenuItem{
|
}
|
||||||
|
}
|
||||||
|
FluIconButton{
|
||||||
|
display: Button.TextOnly
|
||||||
text:cutText
|
text:cutText
|
||||||
|
focus: false
|
||||||
|
padding: 0
|
||||||
|
height: visible ? 34 : 0
|
||||||
visible: inputItem.selectedText !== "" && !inputItem.readOnly
|
visible: inputItem.selectedText !== "" && !inputItem.readOnly
|
||||||
onClicked: {
|
onClicked: {
|
||||||
inputItem.cut()
|
inputItem.cut()
|
||||||
|
menu.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluMenuItem{
|
FluIconButton{
|
||||||
|
display: Button.TextOnly
|
||||||
text:copyText
|
text:copyText
|
||||||
|
focus: false
|
||||||
|
padding: 0
|
||||||
|
height: visible ? 34 : 0
|
||||||
visible: inputItem.selectedText !== ""
|
visible: inputItem.selectedText !== ""
|
||||||
onClicked: {
|
onClicked: {
|
||||||
inputItem.copy()
|
inputItem.copy()
|
||||||
|
menu.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluMenuItem{
|
FluIconButton{
|
||||||
|
display: Button.TextOnly
|
||||||
text:pasteText
|
text:pasteText
|
||||||
|
focus: false
|
||||||
|
padding: 0
|
||||||
|
height: visible ? 34 : 0
|
||||||
visible: inputItem.canPaste
|
visible: inputItem.canPaste
|
||||||
onClicked: {
|
onClicked: {
|
||||||
inputItem.paste()
|
inputItem.paste()
|
||||||
|
menu.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluMenuItem{
|
FluIconButton{
|
||||||
|
display: Button.TextOnly
|
||||||
text:selectAllText
|
text:selectAllText
|
||||||
|
focus: false
|
||||||
|
padding: 0
|
||||||
|
height: visible ? 34 : 0
|
||||||
visible: inputItem.text !== ""
|
visible: inputItem.text !== ""
|
||||||
onClicked: {
|
onClicked: {
|
||||||
inputItem.selectAll()
|
inputItem.selectAll()
|
||||||
|
menu.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ Rectangle {
|
|||||||
property int hourFormat: FluTimePickerType.H
|
property int hourFormat: FluTimePickerType.H
|
||||||
property int isH: hourFormat === FluTimePickerType.H
|
property int isH: hourFormat === FluTimePickerType.H
|
||||||
property var current
|
property var current
|
||||||
|
signal accepted()
|
||||||
id:control
|
id:control
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
@ -23,12 +24,40 @@ Rectangle {
|
|||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: dividerColor
|
border.color: dividerColor
|
||||||
|
Component.onCompleted: {
|
||||||
|
if(current){
|
||||||
|
var now = current;
|
||||||
|
var hour
|
||||||
|
var ampm;
|
||||||
|
if(isH){
|
||||||
|
hour = now.getHours();
|
||||||
|
if(hour>12){
|
||||||
|
ampm = "下午"
|
||||||
|
hour = hour-12
|
||||||
|
}else{
|
||||||
|
ampm = "上午"
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
hour = now.getHours();
|
||||||
|
}
|
||||||
|
hour = text_hour.text === "时"? hour.toString().padStart(2, '0') : text_hour.text
|
||||||
|
var minute = text_minute.text === "分"? now.getMinutes().toString().padStart(2, '0') : text_minute.text
|
||||||
|
ampm = text_ampm.text === "AM/PM"?ampm:text_ampm.text
|
||||||
|
text_hour.text = hour
|
||||||
|
text_minute.text = minute
|
||||||
|
if(isH){
|
||||||
|
text_ampm.text = ampm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Item{
|
Item{
|
||||||
id:d
|
id:d
|
||||||
property var window: Window.window
|
property var window: Window.window
|
||||||
property bool changeFlag: true
|
property bool changeFlag: true
|
||||||
property var rowData: ["","",""]
|
property var rowData: ["","",""]
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:mouse_area
|
id:mouse_area
|
||||||
@ -333,6 +362,7 @@ Rectangle {
|
|||||||
date.setMinutes(parseInt(minutes));
|
date.setMinutes(parseInt(minutes));
|
||||||
date.setSeconds(0);
|
date.setSeconds(0);
|
||||||
current = date
|
current = date
|
||||||
|
control.accepted()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -344,9 +374,7 @@ Rectangle {
|
|||||||
d.rowData[0] = text_hour.text
|
d.rowData[0] = text_hour.text
|
||||||
d.rowData[1] = text_minute.text
|
d.rowData[1] = text_minute.text
|
||||||
d.rowData[2] = text_ampm.text
|
d.rowData[2] = text_ampm.text
|
||||||
|
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
|
|
||||||
var hour
|
var hour
|
||||||
var ampm;
|
var ampm;
|
||||||
if(isH){
|
if(isH){
|
||||||
@ -366,7 +394,6 @@ Rectangle {
|
|||||||
list_view_1.currentIndex = list_view_1.model.indexOf(hour);
|
list_view_1.currentIndex = list_view_1.model.indexOf(hour);
|
||||||
list_view_2.currentIndex = list_view_2.model.indexOf(minute);
|
list_view_2.currentIndex = list_view_2.model.indexOf(minute);
|
||||||
list_view_3.currentIndex = list_view_3.model.indexOf(ampm);
|
list_view_3.currentIndex = list_view_3.model.indexOf(ampm);
|
||||||
|
|
||||||
text_hour.text = hour
|
text_hour.text = hour
|
||||||
text_minute.text = minute
|
text_minute.text = minute
|
||||||
if(isH){
|
if(isH){
|
||||||
|
Loading…
Reference in New Issue
Block a user