This commit is contained in:
zhuzichu 2023-07-04 15:09:48 +08:00
parent a48bc51edc
commit b6c689e0ec
7 changed files with 151 additions and 101 deletions

View File

@ -37,11 +37,6 @@ FluExpander{
rightMargin: 5 rightMargin: 5
topMargin: 5 topMargin: 5
} }
onActiveFocusChanged: {
if(activeFocus){
control.expand = true
}
}
onClicked:{ onClicked:{
FluTools.clipText(content.text) FluTools.clipText(content.text)
showSuccess("复制成功") showSuccess("复制成功")

View File

@ -76,7 +76,6 @@ FluScrollablePage{
Image{ Image{
source: "qrc:/example/res/image/banner_1.jpg" source: "qrc:/example/res/image/banner_1.jpg"
asynchronous: true asynchronous: true
sourceSize: Qt.size(400,300)
fillMode:Image.PreserveAspectCrop fillMode:Image.PreserveAspectCrop
} }
Image{ Image{

View File

@ -70,6 +70,7 @@ Item {
} }
width: parent.width width: parent.width
clip: true clip: true
visible: contentHeight+container.y !== 0
height: contentHeight+container.y height: contentHeight+container.y
Rectangle{ Rectangle{
id:container id:container

View File

@ -747,28 +747,8 @@ Item {
} }
} }
} }
ListView{ Flickable{
id:nav_list id:layout_flickable
clip: true
ScrollBar.vertical: FluScrollBar {}
model:d.handleItems()
boundsBehavior: ListView.StopAtBounds
highlightMoveDuration: 167
highlight: Item{
clip: true
Rectangle{
height: 18
radius: 1.5
color: FluTheme.primaryColor.dark
width: 3
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: 6
}
}
}
currentIndex: -1
anchors{ anchors{
top: layout_header.bottom top: layout_header.bottom
topMargin: 6 topMargin: 6
@ -776,29 +756,58 @@ Item {
right: parent.right right: parent.right
bottom: layout_footer.top bottom: layout_footer.top
} }
delegate: Loader{ boundsBehavior: ListView.StopAtBounds
property var model: modelData clip: true
property var idx: index contentHeight: nav_list.contentHeight
property int type: 0 ScrollBar.vertical: FluScrollBar {}
sourceComponent: { ListView{
if(modelData instanceof FluPaneItem){ id:nav_list
return com_panel_item clip: true
anchors.fill: parent
model:d.handleItems()
boundsBehavior: ListView.StopAtBounds
highlightMoveDuration: 167
highlight: Item{
clip: true
Rectangle{
height: 18
radius: 1.5
color: FluTheme.primaryColor.dark
width: 3
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: 6
}
} }
if(modelData instanceof FluPaneItemHeader){ }
return com_panel_item_header currentIndex: -1
}
if(modelData instanceof FluPaneItemSeparator){ delegate: Loader{
return com_panel_item_separatorr property var model: modelData
} property var idx: index
if(modelData instanceof FluPaneItemExpander){ property int type: 0
return com_panel_item_expander sourceComponent: {
} if(modelData instanceof FluPaneItem){
if(modelData instanceof FluPaneItemEmpty){ return com_panel_item
return com_panel_item_empty }
if(modelData instanceof FluPaneItemHeader){
return com_panel_item_header
}
if(modelData instanceof FluPaneItemSeparator){
return com_panel_item_separatorr
}
if(modelData instanceof FluPaneItemExpander){
return com_panel_item_expander
}
if(modelData instanceof FluPaneItemEmpty){
return com_panel_item_empty
}
} }
} }
} }
} }
ListView{ ListView{
id:layout_footer id:layout_footer
clip: true clip: true

View File

@ -3,7 +3,7 @@ import QtQuick.Controls
import FluentUI import FluentUI
Rectangle { Rectangle {
property real linWidth : width/8 property real linWidth : 5
property real progress: 0.25 property real progress: 0.25
property bool indeterminate: true property bool indeterminate: true
property color primaryColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark property color primaryColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark

View File

@ -41,7 +41,7 @@ T.ScrollBar {
} }
states: [ states: [
State{ State{
name:"hide" name:"show"
when: contentItem.collapsed when: contentItem.collapsed
PropertyChanges { PropertyChanges {
target: rect_bar target: rect_bar
@ -50,7 +50,7 @@ T.ScrollBar {
} }
} }
,State{ ,State{
name:"show" name:"hide"
when: !contentItem.collapsed when: !contentItem.collapsed
PropertyChanges { PropertyChanges {
target: rect_bar target: rect_bar
@ -61,7 +61,7 @@ T.ScrollBar {
] ]
transitions:[ transitions:[
Transition { Transition {
from: "hide" to: "hide"
SequentialAnimation { SequentialAnimation {
PauseAnimation { duration: 450 } PauseAnimation { duration: 450 }
NumberAnimation { NumberAnimation {
@ -69,18 +69,19 @@ T.ScrollBar {
properties: vertical ? "width" : "height" properties: vertical ? "width" : "height"
duration: 167 duration: 167
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
to:2
} }
} }
} }
,Transition { ,Transition {
from: "show" to: "show"
NumberAnimation { SequentialAnimation{
target: rect_bar PauseAnimation { duration: 100 }
properties: vertical ? "width" : "height" NumberAnimation {
duration: 167 target: rect_bar
easing.type: Easing.OutCubic properties: vertical ? "width" : "height"
to:6 duration: 167
easing.type: Easing.OutCubic
}
} }
} }
] ]

View File

@ -222,7 +222,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
color: selected ? control.selectionColor : "#00000000" color: selected ? control.selectionColor : "#00000000"
} }
MouseArea{ MouseArea{
@ -316,26 +316,24 @@ Rectangle {
syncView: table_view syncView: table_view
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
clip: true clip: true
delegate: FluControl { delegate: Rectangle {
id:column_item_control id:column_item_control
readonly property real cellPadding: 8 readonly property real cellPadding: 8
property bool canceled: false
readonly property var obj : columnSource[column] readonly property var obj : columnSource[column]
implicitWidth: column_text.implicitWidth + (cellPadding * 2) implicitWidth: column_text.implicitWidth + (cellPadding * 2)
implicitHeight: Math.max(header_horizontal.height, column_text.implicitHeight + (cellPadding * 2)) implicitHeight: Math.max(header_horizontal.height, column_text.implicitHeight + (cellPadding * 2))
Rectangle{ color:{
anchors.fill: parent d.selectionFlag
color:{ if(column_item_control_mouse.pressed){
d.selectionFlag return control.pressedButtonColor
if(column_item_control.pressed){
return control.pressedButtonColor
}
if(selection_model.isColumnSelected(column)){
return control.hoverButtonColor
}
return column_item_control.hovered ? control.hoverButtonColor : FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
} }
border.color: FluTheme.dark ? "#252525" : "#e4e4e4" if(selection_model.isColumnSelected(column)){
return control.hoverButtonColor
}
return column_item_control_mouse.containsMouse&&!canceled ? control.hoverButtonColor : FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
} }
border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
FluText { FluText {
id: column_text id: column_text
text: model.display text: model.display
@ -348,13 +346,30 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
onClicked: { MouseArea{
closeEditor() id:column_item_control_mouse
selection_model.clear() anchors.fill: parent
for(var i=0;i<=table_view.rows;i++){ anchors.rightMargin: 6
selection_model.select(table_model.index(i,column),ItemSelectionModel.Select) hoverEnabled: true
onCanceled: {
column_item_control.canceled = true
} }
d.selectionFlag = !d.selectionFlag onContainsMouseChanged: {
if(!containsMouse){
column_item_control.canceled = false
}
}
onClicked:
(event)=>{
closeEditor()
if(!(event.modifiers & Qt.ControlModifier)){
selection_model.clear()
}
for(var i=0;i<=table_view.rows;i++){
selection_model.select(table_model.index(i,column),ItemSelectionModel.Select)
}
d.selectionFlag = !d.selectionFlag
}
} }
MouseArea{ MouseArea{
property point clickPos: "0,0" property point clickPos: "0,0"
@ -362,20 +377,28 @@ Rectangle {
width: 6 width: 6
anchors.right: parent.right anchors.right: parent.right
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
hoverEnabled: true
visible: !(obj.width === obj.minimumWidth && obj.width === obj.maximumWidth) visible: !(obj.width === obj.minimumWidth && obj.width === obj.maximumWidth)
cursorShape: Qt.SplitHCursor cursorShape: Qt.SplitHCursor
preventStealing: true
propagateComposedEvents: true
onPressed : onPressed :
(mouse)=>{ (mouse)=>{
header_horizontal.interactive = false
FluTools.setOverrideCursor(Qt.SplitHCursor) FluTools.setOverrideCursor(Qt.SplitHCursor)
clickPos = Qt.point(mouse.x, mouse.y) clickPos = Qt.point(mouse.x, mouse.y)
} }
onReleased:{ onReleased:{
header_horizontal.interactive = true
FluTools.restoreOverrideCursor()
}
onCanceled: {
header_horizontal.interactive = true
FluTools.restoreOverrideCursor() FluTools.restoreOverrideCursor()
} }
onPositionChanged: onPositionChanged:
(mouse)=>{ (mouse)=>{
if(!pressed){
return
}
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y) var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
var minimumWidth = obj.minimumWidth var minimumWidth = obj.minimumWidth
var maximumWidth = obj.maximumWidth var maximumWidth = obj.maximumWidth
@ -409,25 +432,23 @@ Rectangle {
return [] return []
} }
} }
delegate: FluControl{ delegate: Rectangle{
id:item_control id:item_control
readonly property real cellPadding: 8 readonly property real cellPadding: 8
property bool canceled: false
implicitWidth: Math.max(header_vertical.width, row_text.implicitWidth + (cellPadding * 2)) implicitWidth: Math.max(header_vertical.width, row_text.implicitWidth + (cellPadding * 2))
implicitHeight: row_text.implicitHeight + (cellPadding * 2) implicitHeight: row_text.implicitHeight + (cellPadding * 2)
Rectangle{ color: {
anchors.fill: parent d.selectionFlag
color: { if(item_control_mouse.pressed){
d.selectionFlag return control.pressedButtonColor
if(item_control.pressed){
return control.pressedButtonColor
}
if(selection_model.isRowSelected(row)){
return control.hoverButtonColor
}
return item_control.hovered ? control.hoverButtonColor : FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
} }
border.color: FluTheme.dark ? "#252525" : "#e4e4e4" if(selection_model.isRowSelected(row)){
return control.hoverButtonColor
}
return item_control_mouse.containsMouse&&!canceled ? control.hoverButtonColor : FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
} }
border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
FluText{ FluText{
id:row_text id:row_text
anchors.centerIn: parent anchors.centerIn: parent
@ -437,13 +458,30 @@ Rectangle {
return selection_model.rowIntersectsSelection(row) return selection_model.rowIntersectsSelection(row)
} }
} }
onClicked: { MouseArea{
closeEditor() id:item_control_mouse
selection_model.clear() anchors.fill: parent
for(var i=0;i<=columnSource.length;i++){ anchors.bottomMargin: 6
selection_model.select(table_model.index(row,i),ItemSelectionModel.Select) hoverEnabled: true
onCanceled: {
item_control.canceled = true
} }
d.selectionFlag = !d.selectionFlag onContainsMouseChanged: {
if(!containsMouse){
item_control.canceled = false
}
}
onClicked:
(event)=>{
closeEditor()
if(!(event.modifiers & Qt.ControlModifier)){
selection_model.clear()
}
for(var i=0;i<=columnSource.length;i++){
selection_model.select(table_model.index(row,i),ItemSelectionModel.Select)
}
d.selectionFlag = !d.selectionFlag
}
} }
MouseArea{ MouseArea{
property point clickPos: "0,0" property point clickPos: "0,0"
@ -452,22 +490,29 @@ Rectangle {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
cursorShape: Qt.SplitVCursor cursorShape: Qt.SplitVCursor
preventStealing: true
visible: { visible: {
var obj = table_model.getRow(row) var obj = table_model.getRow(row)
return !(obj.height === obj.minimumHeight && obj.width === obj.maximumHeight) return !(obj.height === obj.minimumHeight && obj.width === obj.maximumHeight)
} }
propagateComposedEvents: true
onPressed : onPressed :
(mouse)=>{ (mouse)=>{
header_vertical.interactive = false
FluTools.setOverrideCursor(Qt.SplitVCursor) FluTools.setOverrideCursor(Qt.SplitVCursor)
clickPos = Qt.point(mouse.x, mouse.y) clickPos = Qt.point(mouse.x, mouse.y)
} }
onReleased:{ onReleased:{
header_vertical.interactive = true
FluTools.restoreOverrideCursor()
}
onCanceled: {
header_vertical.interactive = true
FluTools.restoreOverrideCursor() FluTools.restoreOverrideCursor()
} }
onPositionChanged: onPositionChanged:
(mouse)=>{ (mouse)=>{
if(!pressed){
return
}
var obj = table_model.getRow(row) var obj = table_model.getRow(row)
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y) var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
var minimumHeight = obj.minimumHeight var minimumHeight = obj.minimumHeight