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