mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-02-09 00:05:39 +08:00
update
This commit is contained in:
parent
64bbae9266
commit
21ddc79f3f
@ -64,8 +64,8 @@ FluContentPage{
|
|||||||
address: getRandomAddresses(),
|
address: getRandomAddresses(),
|
||||||
nickname: getRandomNickname(),
|
nickname: getRandomNickname(),
|
||||||
longstring:"你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好",
|
longstring:"你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好",
|
||||||
height:46,
|
height:44,
|
||||||
minimumHeight:46,
|
minimumHeight:44,
|
||||||
maximumHeight:300,
|
maximumHeight:300,
|
||||||
action:com_action
|
action:com_action
|
||||||
})
|
})
|
||||||
|
@ -174,7 +174,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluSpinBox{
|
FluSpinBox{
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
disabled: spin_box_switch.checked
|
// disabled: spin_box_switch.checked
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
@ -76,7 +76,7 @@ ComboBox {
|
|||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
implicitWidth: 140
|
implicitWidth: 140
|
||||||
implicitHeight: 28
|
implicitHeight: 32
|
||||||
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
|
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
visible: !control.flat || control.down
|
visible: !control.flat || control.down
|
||||||
|
@ -22,6 +22,8 @@ TextArea{
|
|||||||
}
|
}
|
||||||
font:FluTextStyle.Body
|
font:FluTextStyle.Body
|
||||||
wrapMode: Text.WrapAnywhere
|
wrapMode: Text.WrapAnywhere
|
||||||
|
padding: 8
|
||||||
|
leftPadding: 8
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectedTextColor: color
|
selectedTextColor: color
|
||||||
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
||||||
|
@ -22,6 +22,8 @@ TextField{
|
|||||||
return normalColor
|
return normalColor
|
||||||
}
|
}
|
||||||
font:FluTextStyle.Body
|
font:FluTextStyle.Body
|
||||||
|
padding: 8
|
||||||
|
leftPadding: 8
|
||||||
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
|
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
||||||
|
@ -3,40 +3,145 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluTextBox {
|
Rectangle{
|
||||||
|
readonly property string displayText : d._displayText
|
||||||
|
property int from: 0
|
||||||
|
property int to: 99
|
||||||
|
property var validator: IntValidator {
|
||||||
|
bottom: Math.min(control.from, control.to)
|
||||||
|
top: Math.max(control.from, control.to)
|
||||||
|
}
|
||||||
id:control
|
id:control
|
||||||
width: 200
|
implicitWidth: 200
|
||||||
closeRightMargin:55
|
implicitHeight: 34
|
||||||
|
radius: 4
|
||||||
|
color: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
|
||||||
|
border.width: 1
|
||||||
|
border.color: FluTheme.dark ? Qt.rgba(76/255,76/255,76/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
||||||
|
QtObject{
|
||||||
|
id:d
|
||||||
|
property string _displayText: "0"
|
||||||
|
}
|
||||||
|
Component{
|
||||||
|
id:com_edit
|
||||||
|
FluTextBox{
|
||||||
rightPadding: 80
|
rightPadding: 80
|
||||||
text:"0"
|
closeRightMargin: 55
|
||||||
validator: IntValidator {}
|
validator: control.validator
|
||||||
inputMethodHints: Qt.ImhDigitsOnly
|
text: d._displayText
|
||||||
|
Component.onCompleted: {
|
||||||
|
forceActiveFocus()
|
||||||
|
}
|
||||||
|
onCommit: {
|
||||||
|
var number = Number(text)
|
||||||
|
if(number>=control.from && number<=control.to){
|
||||||
|
d._displayText = String(number)
|
||||||
|
}
|
||||||
|
edit_loader.sourceComponent = null
|
||||||
|
}
|
||||||
|
onActiveFocusChanged: {
|
||||||
|
if(!activeFocus){
|
||||||
|
edit_loader.sourceComponent = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluTextBox{
|
||||||
|
id:text_number
|
||||||
|
anchors.fill: parent
|
||||||
|
readOnly: true
|
||||||
|
rightPadding: 80
|
||||||
|
text: control.displayText
|
||||||
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
edit_loader.sourceComponent = com_edit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loader{
|
||||||
|
id:edit_loader
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
|
id:btn_up
|
||||||
width: 20
|
width: 20
|
||||||
height: 20
|
height: 20
|
||||||
iconSize: 16
|
iconSize: 16
|
||||||
iconSource: FluentIcons.ChevronUp
|
iconSource: FluentIcons.ChevronUp
|
||||||
|
enabled: Number(control.displayText) !== control.to
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
right: parent.right
|
right: parent.right
|
||||||
rightMargin: 30
|
rightMargin: 30
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
control.text = Number(control.text) + 1
|
d._displayText = String(Math.min(Number(d._displayText)+1,control.to))
|
||||||
|
}
|
||||||
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
onReleased: {
|
||||||
|
timer.stop()
|
||||||
|
}
|
||||||
|
TapHandler{
|
||||||
|
onTapped: {
|
||||||
|
btn_up.clicked()
|
||||||
|
}
|
||||||
|
onCanceled: {
|
||||||
|
timer.stop()
|
||||||
|
}
|
||||||
|
onLongPressed: {
|
||||||
|
timer.isUp = true
|
||||||
|
timer.start()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
|
id:btn_down
|
||||||
iconSource: FluentIcons.ChevronDown
|
iconSource: FluentIcons.ChevronDown
|
||||||
width: 20
|
width: 20
|
||||||
height: 20
|
height: 20
|
||||||
iconSize: 16
|
iconSize: 16
|
||||||
|
enabled: Number(control.displayText) !== control.from
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
right: parent.right
|
right: parent.right
|
||||||
rightMargin: 5
|
rightMargin: 5
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
control.text = Number(control.text) - 1
|
d._displayText = String(Math.max(Number(d._displayText)-1,control.from))
|
||||||
|
}
|
||||||
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
onReleased: {
|
||||||
|
timer.stop()
|
||||||
|
}
|
||||||
|
TapHandler{
|
||||||
|
onTapped: {
|
||||||
|
btn_down.clicked()
|
||||||
|
}
|
||||||
|
onCanceled: {
|
||||||
|
timer.stop()
|
||||||
|
}
|
||||||
|
onLongPressed: {
|
||||||
|
timer.isUp = false
|
||||||
|
timer.start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Timer{
|
||||||
|
id:timer
|
||||||
|
property bool isUp : true
|
||||||
|
interval: 50
|
||||||
|
repeat: true
|
||||||
|
onTriggered: {
|
||||||
|
if(isUp){
|
||||||
|
btn_up.clicked()
|
||||||
|
}else{
|
||||||
|
btn_down.clicked()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,6 +154,11 @@ Rectangle {
|
|||||||
selectionModel: ItemSelectionModel {
|
selectionModel: ItemSelectionModel {
|
||||||
id:selection_model
|
id:selection_model
|
||||||
model: table_model
|
model: table_model
|
||||||
|
onSelectionChanged: {
|
||||||
|
if(selection_rect.dragging){
|
||||||
|
d.selectionFlag = !d.selectionFlag
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
columnWidthProvider: function(column) {
|
columnWidthProvider: function(column) {
|
||||||
var w = columnSource[column].width
|
var w = columnSource[column].width
|
||||||
@ -194,7 +199,7 @@ Rectangle {
|
|||||||
implicitWidth: columnSource[column].width
|
implicitWidth: columnSource[column].width
|
||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: item_loader.sourceComponent == null
|
visible: item_loader.sourceComponent === null
|
||||||
color: selected ? control.selectionColor : "#00000000"
|
color: selected ? control.selectionColor : "#00000000"
|
||||||
}
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
@ -258,16 +263,10 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_handle
|
id:com_handle
|
||||||
Item {
|
Item {}
|
||||||
onYChanged: {
|
|
||||||
d.selectionFlag = !d.selectionFlag
|
|
||||||
}
|
|
||||||
onXChanged: {
|
|
||||||
d.selectionFlag = !d.selectionFlag
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SelectionRectangle {
|
SelectionRectangle {
|
||||||
|
id:selection_rect
|
||||||
target: {
|
target: {
|
||||||
if(item_loader.sourceComponent){
|
if(item_loader.sourceComponent){
|
||||||
return null
|
return null
|
||||||
@ -453,7 +452,7 @@ Rectangle {
|
|||||||
var minimumHeight = obj.minimumHeight
|
var minimumHeight = obj.minimumHeight
|
||||||
var maximumHeight = obj.maximumHeight
|
var maximumHeight = obj.maximumHeight
|
||||||
if(!minimumHeight){
|
if(!minimumHeight){
|
||||||
minimumHeight = 46
|
minimumHeight = 44
|
||||||
}
|
}
|
||||||
if(!maximumHeight){
|
if(!maximumHeight){
|
||||||
maximumHeight = 65535
|
maximumHeight = 65535
|
||||||
|
@ -15,6 +15,8 @@ TextField{
|
|||||||
property int closeRightMargin: icon_end.visible ? 25 : 5
|
property int closeRightMargin: icon_end.visible ? 25 : 5
|
||||||
id:control
|
id:control
|
||||||
width: 300
|
width: 300
|
||||||
|
padding: 8
|
||||||
|
leftPadding: 8
|
||||||
enabled: !disabled
|
enabled: !disabled
|
||||||
color: {
|
color: {
|
||||||
if(!enabled){
|
if(!enabled){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user