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
topMargin: 5
}
onActiveFocusChanged: {
if(activeFocus){
control.expand = true
}
}
onClicked:{
FluTools.clipText(content.text)
showSuccess("复制成功")

View File

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

View File

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

View File

@ -747,28 +747,8 @@ Item {
}
}
}
ListView{
id:nav_list
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
Flickable{
id:layout_flickable
anchors{
top: layout_header.bottom
topMargin: 6
@ -776,29 +756,58 @@ Item {
right: parent.right
bottom: layout_footer.top
}
delegate: Loader{
property var model: modelData
property var idx: index
property int type: 0
sourceComponent: {
if(modelData instanceof FluPaneItem){
return com_panel_item
boundsBehavior: ListView.StopAtBounds
clip: true
contentHeight: nav_list.contentHeight
ScrollBar.vertical: FluScrollBar {}
ListView{
id:nav_list
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
}
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
}
currentIndex: -1
delegate: Loader{
property var model: modelData
property var idx: index
property int type: 0
sourceComponent: {
if(modelData instanceof FluPaneItem){
return com_panel_item
}
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{
id:layout_footer
clip: true

View File

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

View File

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

View File

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