main
zhuzihcu 2023-04-12 11:55:39 +08:00
parent cd984fddf5
commit 5ca1b715f3
7 changed files with 60 additions and 16 deletions

View File

@ -9,7 +9,14 @@ FluObject{
FluPaneItem{ FluPaneItem{
title:"Home" title:"Home"
icon:FluentIcons.Home // icon:FluentIcons.Home
cusIcon: Image{
anchors.centerIn: parent
source: "qrc:/res/svg/home.svg"
sourceSize: Qt.size(30,30)
width: 18
height: 18
}
onTap:{ onTap:{
navigationView.push("qrc:/T_Home.qml") navigationView.push("qrc:/T_Home.qml")
} }

View File

@ -160,5 +160,6 @@
<file>T_StatusView.qml</file> <file>T_StatusView.qml</file>
<file>T_Settings.qml</file> <file>T_Settings.qml</file>
<file>global/MainEvent.qml</file> <file>global/MainEvent.qml</file>
<file>res/svg/home.svg</file>
</qresource> </qresource>
</RCC> </RCC>

1
example/res/svg/home.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1681271578882" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3664" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M923.733333 394.666667c-85.333333-70.4-206.933333-174.933333-362.666666-309.333334C533.333333 61.866667 490.666667 61.866667 462.933333 85.333333c-155.733333 134.4-277.333333 238.933333-362.666666 309.333334-14.933333 14.933333-25.6 34.133333-25.6 53.333333 0 38.4 32 70.4 70.4 70.4H192v358.4c0 29.866667 23.466667 53.333333 53.333333 53.333333H405.333333c29.866667 0 53.333333-23.466667 53.333334-53.333333v-206.933333h106.666666v206.933333c0 29.866667 23.466667 53.333333 53.333334 53.333333h160c29.866667 0 53.333333-23.466667 53.333333-53.333333V518.4h46.933333c38.4 0 70.4-32 70.4-70.4 0-21.333333-10.666667-40.533333-25.6-53.333333z m-44.8 59.733333h-57.6c-29.866667 0-53.333333 23.466667-53.333333 53.333333v358.4h-138.666667V661.333333c0-29.866667-23.466667-53.333333-53.333333-53.333333h-128c-29.866667 0-53.333333 23.466667-53.333333 53.333333v206.933334H256V507.733333c0-29.866667-23.466667-53.333333-53.333333-53.333333H145.066667c-4.266667 0-6.4-2.133333-6.4-6.4 0-2.133333 2.133333-4.266667 2.133333-6.4 85.333333-70.4 206.933333-174.933333 362.666667-309.333333 4.266667-4.266667 10.666667-4.266667 14.933333 0 155.733333 134.4 277.333333 238.933333 362.666667 309.333333 2.133333 2.133333 2.133333 2.133333 2.133333 4.266667 2.133333 6.4-2.133333 8.533333-4.266667 8.533333z" fill="#2c2c2c" p-id="3665"></path></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -246,22 +246,37 @@ Item {
return Qt.rgba(0,0,0,0) return Qt.rgba(0,0,0,0)
} }
} }
Component{
id:com_icon
FluIcon{ FluIcon{
id:item_icon
iconSource: { iconSource: {
if(model.icon){ if(model.icon){
return model.icon return model.icon
} }
return 0 return 0
} }
iconSize: 15
}
}
Item{
id:item_icon
width: 30 width: 30
height: 30 height: 30
iconSize: 15
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left:parent.left left:parent.left
leftMargin: 3 leftMargin: 3
} }
Loader{
anchors.centerIn: parent
sourceComponent: {
if(model.cusIcon){
return model.cusIcon
}
return com_icon
}
}
} }
FluText{ FluText{
id:item_title id:item_title
@ -382,23 +397,39 @@ Item {
return Qt.rgba(0,0,0,0) return Qt.rgba(0,0,0,0)
} }
} }
Component{
id:com_icon
FluIcon{ FluIcon{
id:item_icon
iconSource: { iconSource: {
if(model.icon){ if(model.icon){
return model.icon return model.icon
} }
return 0 return 0
} }
iconSize: 15
}
}
Item{
id:item_icon
width: 30 width: 30
height: 30 height: 30
iconSize: 15
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left:parent.left left:parent.left
leftMargin: 3 leftMargin: 3
} }
Loader{
anchors.centerIn: parent
sourceComponent: {
if(model.cusIcon){
return model.cusIcon
} }
return com_icon
}
}
}
FluText{ FluText{
id:item_title id:item_title
text:model.title text:model.title

View File

@ -7,6 +7,7 @@ QtObject {
property string title property string title
property int order : 0 property int order : 0
property int icon property int icon
property Component cusIcon
property bool recentlyAdded: false property bool recentlyAdded: false
property bool recentlyUpdated: false property bool recentlyUpdated: false
property string desc property string desc

View File

@ -4,7 +4,8 @@ import FluentUI
FluObject { FluObject {
readonly property string key : FluApp.uuid() readonly property string key : FluApp.uuid()
property string title property string title
property int icon property var icon
property Component cusIcon
property bool isExpand: false property bool isExpand: false
property var parent property var parent
property int idx property int idx

View File

@ -56,6 +56,8 @@ ApplicationWindow {
Component.onCompleted: { Component.onCompleted: {
helper.initWindow(window) helper.initWindow(window)
initArgument(argument) initArgument(argument)
window.x = (Screen.width - window.width)/2
window.y = (Screen.desktopAvailableHeight - window.height)/2
} }
function showSuccess(text,duration,moremsg){ function showSuccess(text,duration,moremsg){