2023-03-30 21:52:55 +08:00
|
|
|
|
import QtQuick
|
|
|
|
|
import FluentUI
|
2023-02-26 23:47:07 +08:00
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
|
2023-03-09 23:11:59 +08:00
|
|
|
|
property int fontStyle: FluText.Body
|
2023-04-07 20:19:18 +08:00
|
|
|
|
property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220
|
2023-03-09 23:11:59 +08:00
|
|
|
|
property int pixelSize : FluTheme.textSize
|
2023-02-26 23:47:07 +08:00
|
|
|
|
|
|
|
|
|
enum FontStyle {
|
|
|
|
|
Display,
|
|
|
|
|
TitleLarge,
|
|
|
|
|
Title,
|
2023-03-29 21:43:01 +08:00
|
|
|
|
SubTitle,
|
2023-02-26 23:47:07 +08:00
|
|
|
|
BodyStrong,
|
|
|
|
|
Body,
|
|
|
|
|
Caption
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-09 23:11:59 +08:00
|
|
|
|
id:text
|
2023-02-26 23:47:07 +08:00
|
|
|
|
color: textColor
|
2023-03-28 21:37:10 +08:00
|
|
|
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
2023-02-28 18:29:00 +08:00
|
|
|
|
font.bold: {
|
|
|
|
|
switch (fontStyle) {
|
|
|
|
|
case FluText.Display:
|
|
|
|
|
return true
|
|
|
|
|
case FluText.TitleLarge:
|
|
|
|
|
return true
|
|
|
|
|
case FluText.Title:
|
|
|
|
|
return true
|
2023-03-29 21:43:01 +08:00
|
|
|
|
case FluText.SubTitle:
|
2023-02-28 18:29:00 +08:00
|
|
|
|
return true
|
|
|
|
|
case FluText.BodyStrong:
|
|
|
|
|
return true
|
|
|
|
|
case FluText.Body:
|
|
|
|
|
return false
|
|
|
|
|
case FluText.Caption:
|
|
|
|
|
return false
|
|
|
|
|
default:
|
|
|
|
|
return false
|
|
|
|
|
}
|
2023-02-26 23:47:07 +08:00
|
|
|
|
}
|
2023-02-28 18:29:00 +08:00
|
|
|
|
font.pixelSize: {
|
2023-02-26 23:47:07 +08:00
|
|
|
|
switch (fontStyle) {
|
2023-02-28 18:29:00 +08:00
|
|
|
|
case FluText.Display:
|
2023-03-29 21:43:01 +08:00
|
|
|
|
return text.pixelSize * 4.857
|
2023-02-28 18:29:00 +08:00
|
|
|
|
case FluText.TitleLarge:
|
2023-03-29 21:43:01 +08:00
|
|
|
|
return text.pixelSize * 2.857
|
2023-02-28 18:29:00 +08:00
|
|
|
|
case FluText.Title:
|
2023-03-29 21:43:01 +08:00
|
|
|
|
return text.pixelSize * 2
|
|
|
|
|
case FluText.SubTitle:
|
|
|
|
|
return text.pixelSize * 1.428
|
2023-02-28 18:29:00 +08:00
|
|
|
|
case FluText.Body:
|
2023-02-28 23:57:55 +08:00
|
|
|
|
return text.pixelSize * 1.0
|
2023-03-29 21:43:01 +08:00
|
|
|
|
case FluText.BodyStrong:
|
|
|
|
|
return text.pixelSize * 1.0
|
2023-02-28 18:29:00 +08:00
|
|
|
|
case FluText.Caption:
|
2023-03-29 21:43:01 +08:00
|
|
|
|
return text.pixelSize * 0.857
|
2023-02-28 18:29:00 +08:00
|
|
|
|
default:
|
|
|
|
|
return text.pixelSize * 1.0
|
2023-02-26 23:47:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|