-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
朱子楚\zhuzi
committed
Mar 20, 2023
1 parent
e29cb74
commit b83e70b
Showing
7 changed files
with
186 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import QtQuick 2.15 | ||
import QtQuick.Layouts 1.15 | ||
import QtQuick.Window 2.15 | ||
import QtQuick.Controls 2.15 | ||
import QtGraphicalEffects 1.15 | ||
import FluentUI 1.0 | ||
|
||
FluScrollablePage{ | ||
|
||
title:"Badge" | ||
|
||
|
||
FluArea{ | ||
width: parent.width | ||
Layout.topMargin: 20 | ||
height: 106 | ||
paddings: 10 | ||
|
||
Column{ | ||
spacing: 15 | ||
anchors{ | ||
verticalCenter: parent.verticalCenter | ||
left: parent.left | ||
} | ||
FluText{ | ||
text:"一般出现在通知图标或头像的右上角,用于显示需要处理的消息条数" | ||
} | ||
|
||
Row{ | ||
spacing: 20 | ||
Rectangle{ | ||
width: 40 | ||
height: 40 | ||
radius: 8 | ||
color: Qt.rgba(191/255,191/255,191/255,1) | ||
FluBadge{ | ||
count:0 | ||
} | ||
} | ||
|
||
Rectangle{ | ||
width: 40 | ||
height: 40 | ||
radius: 8 | ||
color: Qt.rgba(191/255,191/255,191/255,1) | ||
FluBadge{ | ||
count:5 | ||
} | ||
} | ||
Rectangle{ | ||
width: 40 | ||
height: 40 | ||
radius: 8 | ||
color: Qt.rgba(191/255,191/255,191/255,1) | ||
FluBadge{ | ||
count:50 | ||
} | ||
} | ||
Rectangle{ | ||
width: 40 | ||
height: 40 | ||
radius: 8 | ||
color: Qt.rgba(191/255,191/255,191/255,1) | ||
FluBadge{ | ||
count:100 | ||
} | ||
} | ||
Rectangle{ | ||
width: 40 | ||
height: 40 | ||
radius: 8 | ||
color: Qt.rgba(191/255,191/255,191/255,1) | ||
FluBadge{ | ||
isDot:true | ||
} | ||
} | ||
Rectangle{ | ||
width: 40 | ||
height: 40 | ||
radius: 8 | ||
color: Qt.rgba(191/255,191/255,191/255,1) | ||
FluBadge{ | ||
count:99 | ||
color: Qt.rgba(250/255,173/255,20/255,1) | ||
} | ||
} | ||
Rectangle{ | ||
width: 40 | ||
height: 40 | ||
radius: 8 | ||
color: Qt.rgba(191/255,191/255,191/255,1) | ||
FluBadge{ | ||
count:99 | ||
color: Qt.rgba(82/255,196/255,26/255,1) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import FluentUI 1.0 | |
|
||
FluScrollablePage{ | ||
|
||
title:"TextBox" | ||
title:"Tooltip" | ||
|
||
FluText{ | ||
Layout.topMargin: 20 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,77 @@ | ||
import QtQuick 2.15 | ||
|
||
Item { | ||
Rectangle{ | ||
|
||
property bool isDot: false | ||
property bool showZero: true | ||
property int count: 0 | ||
|
||
Rectangle{ | ||
|
||
id:control | ||
color:Qt.rgba(255/255,77/255,79/255,1) | ||
width: { | ||
if(isDot) | ||
return 10 | ||
if(count<10){ | ||
return 20 | ||
}else if(count<100){ | ||
return 30 | ||
} | ||
return 40 | ||
} | ||
height: { | ||
if(isDot) | ||
return 10 | ||
return 20 | ||
} | ||
radius: { | ||
if(isDot) | ||
return 5 | ||
return 10 | ||
} | ||
border.width: 1 | ||
border.color: Qt.rgba(1,1,1,1) | ||
visible: { | ||
if(showZero) | ||
return true | ||
return count!==0 | ||
} | ||
anchors{ | ||
right: { | ||
if(parent) | ||
return parent.right | ||
return undefined | ||
} | ||
top: { | ||
if(parent) | ||
return parent.top | ||
return undefined | ||
} | ||
rightMargin: { | ||
if(isDot){ | ||
return -2.5 | ||
} | ||
return -(control.width/2) | ||
} | ||
topMargin: { | ||
if(isDot){ | ||
return -2.5 | ||
} | ||
return -10 | ||
} | ||
} | ||
|
||
Text{ | ||
anchors.centerIn: parent | ||
color: Qt.rgba(1,1,1,1) | ||
visible: !isDot | ||
text:{ | ||
if(count<100) | ||
return count | ||
return count+"+" | ||
} | ||
} | ||
|
||
|
||
|
||
} |