2023-03-25 13:35:21 +08:00
|
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
import FluentUI 1.0
|
2023-02-26 23:47:07 +08:00
|
|
|
|
|
2023-03-02 12:20:16 +08:00
|
|
|
|
TextField{
|
2023-03-09 23:11:59 +08:00
|
|
|
|
|
|
|
|
|
property int fontStyle: FluText.Body
|
|
|
|
|
property int pixelSize : FluTheme.textSize
|
2023-03-20 18:22:32 +08:00
|
|
|
|
property bool disabled: false
|
2023-03-09 23:11:59 +08:00
|
|
|
|
|
2023-03-02 12:20:16 +08:00
|
|
|
|
id:input
|
|
|
|
|
width: 300
|
2023-03-20 18:22:32 +08:00
|
|
|
|
enabled: !disabled
|
|
|
|
|
color: {
|
|
|
|
|
if(disabled){
|
2023-03-28 21:37:10 +08:00
|
|
|
|
return FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
2023-03-20 18:22:32 +08:00
|
|
|
|
}
|
2023-03-28 21:37:10 +08:00
|
|
|
|
return FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
2023-03-20 18:22:32 +08:00
|
|
|
|
}
|
2023-03-28 21:37:10 +08:00
|
|
|
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
2023-03-02 12:20:16 +08:00
|
|
|
|
selectionColor: {
|
2023-03-28 21:37:10 +08:00
|
|
|
|
if(FluTheme.dark){
|
2023-03-06 12:09:06 +08:00
|
|
|
|
return FluTheme.primaryColor.lighter
|
2023-03-02 12:20:16 +08:00
|
|
|
|
}else{
|
2023-03-06 12:09:06 +08:00
|
|
|
|
return FluTheme.primaryColor.dark
|
2023-03-02 12:20:16 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-09 23:11:59 +08:00
|
|
|
|
placeholderTextColor: {
|
2023-03-20 18:22:32 +08:00
|
|
|
|
if(disabled){
|
2023-03-28 21:37:10 +08:00
|
|
|
|
return FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
2023-03-20 18:22:32 +08:00
|
|
|
|
}
|
2023-03-09 23:11:59 +08:00
|
|
|
|
if(focus){
|
2023-03-28 21:37:10 +08:00
|
|
|
|
return FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
|
2023-03-09 23:11:59 +08:00
|
|
|
|
}
|
2023-03-28 21:37:10 +08:00
|
|
|
|
return FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
|
2023-03-09 23:11:59 +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-03-09 23:11:59 +08:00
|
|
|
|
return true
|
|
|
|
|
case FluText.BodyStrong:
|
|
|
|
|
return true
|
|
|
|
|
case FluText.Body:
|
|
|
|
|
return false
|
|
|
|
|
case FluText.Caption:
|
|
|
|
|
return false
|
|
|
|
|
default:
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
font.pixelSize: {
|
|
|
|
|
switch (fontStyle) {
|
|
|
|
|
case FluText.Display:
|
2023-03-29 21:43:01 +08:00
|
|
|
|
return text.pixelSize * 4.857
|
2023-03-09 23:11:59 +08:00
|
|
|
|
case FluText.TitleLarge:
|
2023-03-29 21:43:01 +08:00
|
|
|
|
return text.pixelSize * 2.857
|
2023-03-09 23:11:59 +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-03-09 23:11:59 +08:00
|
|
|
|
case FluText.Body:
|
2023-03-29 21:43:01 +08:00
|
|
|
|
return text.pixelSize * 1.0
|
|
|
|
|
case FluText.BodyStrong:
|
|
|
|
|
return text.pixelSize * 1.0
|
2023-03-09 23:11:59 +08:00
|
|
|
|
case FluText.Caption:
|
2023-03-29 21:43:01 +08:00
|
|
|
|
return text.pixelSize * 0.857
|
2023-03-09 23:11:59 +08:00
|
|
|
|
default:
|
2023-03-29 21:43:01 +08:00
|
|
|
|
return text.pixelSize * 1.0
|
2023-03-09 23:11:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-02 12:20:16 +08:00
|
|
|
|
selectByMouse: true
|
|
|
|
|
background: FluTextBoxBackground{
|
|
|
|
|
inputItem: input
|
|
|
|
|
}
|
2023-02-26 23:47:07 +08:00
|
|
|
|
|
|
|
|
|
}
|
2023-03-02 12:20:16 +08:00
|
|
|
|
|