This commit is contained in:
zhuzichu 2023-07-07 11:47:03 +08:00
parent a273aa4588
commit 9223d5f937
12 changed files with 57 additions and 79 deletions

View File

@ -23,8 +23,6 @@ FluScrollablePage{
text:"此颜色组件是Github上的开源项目" text:"此颜色组件是Github上的开源项目"
} }
FluTextButton{ FluTextButton{
leftPadding: 0
rightPadding: 0
text:"https://github.com/rshest/qml-colorpicker" text:"https://github.com/rshest/qml-colorpicker"
onClicked: { onClicked: {
Qt.openUrlExternally(text) Qt.openUrlExternally(text)

View File

@ -168,9 +168,9 @@ CustomWindow {
width: parent.width width: parent.width
height: parent.height height: parent.height
z:999 z:999
//NoStack
// pageMode: FluNavigationView.NoStack
//StackpopFluPagelaunchMode //StackpopFluPagelaunchMode
// pageMode: FluNavigationView.Stack
//NoStack
pageMode: FluNavigationView.NoStack pageMode: FluNavigationView.NoStack
items: ItemsOriginal items: ItemsOriginal
footerItems:ItemsFooter footerItems:ItemsFooter

View File

@ -30,15 +30,10 @@ FluTextBox{
duration: 83 duration: 83
} }
} }
onVisibleChanged: { background: FluRectangle{
if(visible){
list_view.currentIndex = -1
}
}
background: Rectangle{
id:container id:container
width: control.width width: control.width
radius: 4 radius: [4,4,4,4]
FluShadow{ FluShadow{
radius: 4 radius: 4
} }
@ -48,7 +43,7 @@ FluTextBox{
id:list_view id:list_view
anchors.fill: parent anchors.fill: parent
clip: true clip: true
currentIndex: -1 boundsBehavior: ListView.StopAtBounds
ScrollBar.vertical: FluScrollBar {} ScrollBar.vertical: FluScrollBar {}
header: Item{ header: Item{
width: control.width width: control.width
@ -63,49 +58,30 @@ FluTextBox{
} }
} }
} }
delegate:Control{ delegate:FluControl{
id:item_control
height: 38
width: control.width width: control.width
padding:10 onClicked:{
background: Rectangle{ handleClick(modelData)
color: {
if(list_view.currentIndex === index){
return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
} }
background: Rectangle{
FluFocusRectangle{
visible: item_control.activeFocus
radius:4
}
color: {
if(hovered){ if(hovered){
return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1) return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
} }
return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0) return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0)
} }
MouseArea{
id:mouse_area
anchors.fill: parent
Connections{
target: control
function onHandleClicked(){
if((list_view.currentIndex === index)){
handleClick(modelData)
}
}
}
onClicked: handleClick(modelData)
}
Rectangle{
width: 3
color:FluTheme.primaryColor.dark
visible: list_view.currentIndex === index
radius: 3
height: 20
anchors{
left: parent.left
verticalCenter: parent.verticalCenter
}
}
} }
contentItem: FluText{ contentItem: FluText{
text:modelData.title text:modelData.title
anchors{ leftPadding: 10
verticalCenter: parent.verticalCenter rightPadding: 10
} verticalAlignment : Qt.AlignVCenter
} }
} }
} }

View File

@ -2,38 +2,41 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import FluentUI import FluentUI
Item { Image {
property alias sourceSize : image.sourceSize
property alias fillMode : image.fillMode
property url source
property string errorButtonText: "重新加载" property string errorButtonText: "重新加载"
property var status
property var clickErrorListener : function(){ property var clickErrorListener : function(){
image.source = "" image.source = ""
image.source = control.source image.source = control.source
} }
property Component errorItem : com_error
property Component loadingItem: com_loading
id: control id: control
Image{ Loader{
id:image
anchors.fill: parent anchors.fill: parent
source: control.source sourceComponent: {
opacity: control.status === Image.Ready if(control.status === Image.Loading){
onStatusChanged:{ return com_loading
control.status = image.status }else if(control.status == Image.Error){
} return com_error
Behavior on opacity { }else{
NumberAnimation{ return undefined
duration: 83
} }
} }
} }
Component{
id:com_loading
Rectangle{ Rectangle{
anchors.fill: parent
color: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03) color: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03)
FluProgressRing{ FluProgressRing{
anchors.centerIn: parent anchors.centerIn: parent
visible: control.status === Image.Loading visible: control.status === Image.Loading
} }
}
}
Component{
id:com_error
Rectangle{
color: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03)
FluFilledButton{ FluFilledButton{
text: control.errorButtonText text: control.errorButtonText
anchors.centerIn: parent anchors.centerIn: parent
@ -42,3 +45,4 @@ Item {
} }
} }
} }
}

View File

@ -1097,7 +1097,7 @@ Item {
var items = getItems() var items = getItems()
for(var i=0;i<items.length;i++){ for(var i=0;i<items.length;i++){
var item = items[i] var item = items[i]
if(item._key === data._key){ if(item.key === data.key){
if(getCurrentIndex() === i){ if(getCurrentIndex() === i){
return return
} }

View File

@ -3,7 +3,7 @@ import QtQuick.Controls
import FluentUI import FluentUI
QtObject { QtObject {
readonly property string _key : FluTools.uuid() readonly property string key : FluTools.uuid()
property int _idx property int _idx
property var _ext property var _ext
property string title property string title

View File

@ -3,7 +3,7 @@ import QtQuick.Controls
import FluentUI import FluentUI
QtObject { QtObject {
readonly property string _key : FluTools.uuid() readonly property string key : FluTools.uuid()
property int _idx property int _idx
property var _ext property var _ext
property var parent property var parent

View File

@ -3,7 +3,7 @@ import QtQuick.Controls
import FluentUI import FluentUI
FluObject { FluObject {
readonly property string _key : FluTools.uuid() readonly property string key : FluTools.uuid()
property int _idx property int _idx
property string title property string title
property var icon property var icon

View File

@ -3,7 +3,7 @@ import QtQuick.Controls
import FluentUI import FluentUI
QtObject { QtObject {
readonly property string _key : FluTools.uuid() readonly property string key : FluTools.uuid()
property int _idx property int _idx
property string title property string title
property var parent property var parent

View File

@ -3,7 +3,7 @@ import QtQuick.Controls
import FluentUI import FluentUI
QtObject { QtObject {
readonly property string _key : FluTools.uuid() readonly property string key : FluTools.uuid()
property int _idx property int _idx
property var parent property var parent
} }

View File

@ -42,7 +42,7 @@ Item{
if(statusMode === FluStatusView.Error){ if(statusMode === FluStatusView.Error){
return errorItem return errorItem
} }
return null return undefined
} }
} }
Component{ Component{

View File

@ -246,7 +246,7 @@ Rectangle {
} }
onClicked: onClicked:
(event)=>{ (event)=>{
item_loader.sourceComponent = null item_loader.sourceComponent = undefined
if(!(event.modifiers & Qt.ControlModifier)){ if(!(event.modifiers & Qt.ControlModifier)){
selection_model.clear() selection_model.clear()
} }
@ -279,7 +279,7 @@ Rectangle {
property int column property int column
property int row property int row
property var tableView: control property var tableView: control
sourceComponent: null sourceComponent: undefined
onDisplayChanged: { onDisplayChanged: {
var obj = table_model.getRow(row) var obj = table_model.getRow(row)
obj[columnSource[column].dataIndex] = display obj[columnSource[column].dataIndex] = display