2023-02-28 18:29:00 +08:00
|
|
|
|
import QtQuick 2.15
|
2023-03-02 12:20:16 +08:00
|
|
|
|
import QtQuick.Controls 2.15
|
2023-02-28 18:29:00 +08:00
|
|
|
|
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-02 12:20:16 +08:00
|
|
|
|
id:input
|
|
|
|
|
width: 300
|
2023-03-06 14:22:13 +08:00
|
|
|
|
color: FluTheme.isDark ? "#FFFFFF" : "#1A1A1A"
|
2023-03-11 21:15:36 +08:00
|
|
|
|
renderType: FluTheme.isNativeText ? Text.NativeRendering : Text.QtRendering
|
2023-03-02 12:20:16 +08:00
|
|
|
|
selectionColor: {
|
2023-03-06 14:22:13 +08:00
|
|
|
|
if(FluTheme.isDark){
|
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: {
|
|
|
|
|
if(focus){
|
|
|
|
|
return FluTheme.isDark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
|
|
|
|
|
}
|
|
|
|
|
return FluTheme.isDark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
|
|
|
|
|
}
|
|
|
|
|
font.bold: {
|
|
|
|
|
switch (fontStyle) {
|
|
|
|
|
case FluText.Display:
|
|
|
|
|
return true
|
|
|
|
|
case FluText.TitleLarge:
|
|
|
|
|
return true
|
|
|
|
|
case FluText.Title:
|
|
|
|
|
return true
|
|
|
|
|
case FluText.Subtitle:
|
|
|
|
|
return true
|
|
|
|
|
case FluText.BodyLarge:
|
|
|
|
|
return false
|
|
|
|
|
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:
|
|
|
|
|
return input.pixelSize * 4
|
|
|
|
|
case FluText.TitleLarge:
|
|
|
|
|
return input.pixelSize * 2
|
|
|
|
|
case FluText.Title:
|
|
|
|
|
return input.pixelSize * 1.5
|
|
|
|
|
case FluText.Subtitle:
|
|
|
|
|
return input.pixelSize * 0.9
|
|
|
|
|
case FluText.BodyLarge:
|
|
|
|
|
return input.pixelSize * 1.1
|
|
|
|
|
case FluText.BodyStrong:
|
|
|
|
|
return input.pixelSize * 1.0
|
|
|
|
|
case FluText.Body:
|
|
|
|
|
return input.pixelSize * 1.0
|
|
|
|
|
case FluText.Caption:
|
|
|
|
|
return input.pixelSize * 0.8
|
|
|
|
|
default:
|
|
|
|
|
return input.pixelSize * 1.0
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
|