This commit is contained in:
zhuzihcu
2023-06-13 11:48:29 +08:00
parent ac602c5afa
commit fd0ddbf5aa
5 changed files with 64 additions and 22 deletions

View File

@ -4,8 +4,9 @@ import FluentUI
Rectangle{
property bool isDot: false
property bool showZero: true
property bool showZero: false
property int count: 0
property bool topRight: false
id:control
color:Qt.rgba(255/255,77/255,79/255,1)
width: {
@ -14,7 +15,7 @@ Rectangle{
if(count<10){
return 20
}else if(count<100){
return 30
return 30
}
return 40
}
@ -30,35 +31,41 @@ Rectangle{
}
border.width: 1
border.color: Qt.rgba(1,1,1,1)
visible: {
if(showZero)
return true
return count!==0
}
anchors{
right: {
if(parent)
if(parent && topRight)
return parent.right
return undefined
}
top: {
if(parent)
if(parent && topRight)
return parent.top
return undefined
}
rightMargin: {
if(isDot){
return -2.5
if(parent && topRight){
if(isDot){
return -2.5
}
return -(control.width/2)
}
return -(control.width/2)
return 0
}
topMargin: {
if(isDot){
return -2.5
if(parent && topRight){
if(isDot){
return -2.5
}
return -10
}
return -10
return 0
}
}
visible: {
if(showZero)
return true
return count!==0
}
Text{
anchors.centerIn: parent
color: Qt.rgba(1,1,1,1)

View File

@ -440,6 +440,19 @@ Item {
left:item_icon.right
}
}
Loader{
anchors{
right: parent.right
rightMargin: 10
verticalCenter: parent.verticalCenter
}
sourceComponent: {
if(model.infoBadge){
return model.infoBadge
}
return undefined
}
}
}
}
}
@ -922,6 +935,12 @@ Item {
function getCurrentIndex(){
return nav_list.currentIndex
}
function getCurrentUrl(){
if(nav_swipe.currentItem){
return nav_swipe.currentItem.url
}
return undefined
}
function startPageByItem(data){
var items = getItems()
for(var i=0;i<items.length;i++){

View File

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