Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
朱子楚\zhuzi committed Sep 13, 2023
1 parent 3b61985 commit af74f35
Show file tree
Hide file tree
Showing 16 changed files with 114 additions and 137 deletions.
1 change: 1 addition & 0 deletions example/qml-Qt6/App.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Window {
FluApp.init(app)
FluTheme.darkMode = FluThemeType.System
FluTheme.enableAnimation = true
FluTheme.nativeText = true
FluApp.routes = {
"/":"qrc:/example/qml/window/MainWindow.qml",
"/about":"qrc:/example/qml/window/AboutWindow.qml",
Expand Down
1 change: 1 addition & 0 deletions example/qml/App.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Window {
FluApp.init(app)
FluTheme.darkMode = FluThemeType.System
FluTheme.enableAnimation = true
FluTheme.nativeText = true
FluApp.routes = {
"/":"qrc:/example/qml/window/MainWindow.qml",
"/about":"qrc:/example/qml/window/AboutWindow.qml",
Expand Down
7 changes: 1 addition & 6 deletions src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ FluPopup {
right: parent.right
}
}

Flickable{
id:sroll_message
contentWidth: width
Expand All @@ -47,11 +46,10 @@ FluPopup {
left: parent.left
right: parent.right
}
boundsBehavior:Flickable.StopAtBounds
contentHeight: text_message.height
clip: true
height: Math.min(text_message.height,300)
ScrollBar.vertical: FluScrollBar {}

FluText{
id:text_message
font: FluTextStyle.Body
Expand All @@ -63,9 +61,7 @@ FluPopup {
rightPadding: 20
bottomPadding: 14
}

}

Rectangle{
id:layout_actions
height: 68
Expand Down Expand Up @@ -140,4 +136,3 @@ FluPopup {
}
}
}

4 changes: 2 additions & 2 deletions src/Qt5/imports/FluentUI/Controls/FluMultilineTextBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ TextArea{
}
font:FluTextStyle.Body
wrapMode: Text.WrapAnywhere
padding: 8
leftPadding: padding+2
padding: 7
leftPadding: padding+4
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectedTextColor: color
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor.lightest,0.6)
Expand Down
23 changes: 5 additions & 18 deletions src/Qt5/imports/FluentUI/Controls/FluPasswordBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ TextField{
return normalColor
}
font:FluTextStyle.Body
padding: 8
leftPadding: padding+2
padding: 7
leftPadding: padding+4
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor.lightest,0.6)
Expand All @@ -36,22 +36,9 @@ TextField{
return placeholderNormalColor
}
selectByMouse: true
rightPadding: icon_end.visible ? 50 : 30
background: FluTextBoxBackground{
inputItem: control
implicitWidth: 240
FluIcon{
id:icon_end
iconSource: control.iconSource
iconSize: 15
opacity: 0.5
visible: control.iconSource != 0
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: 5
}
}
}
Keys.onEnterPressed: (event)=> d.handleCommit(event)
Keys.onReturnPressed:(event)=> d.handleCommit(event)
Expand All @@ -65,16 +52,16 @@ TextField{
id:btn_reveal
iconSource:FluentIcons.RevealPasswordMedium
iconSize: 10
width: 20
width: 30
height: 20
verticalPadding: 0
horizontalPadding: 0
opacity: 0.5
iconColor: FluTheme.dark ? Qt.rgba(222/255,222/255,222/255,1) : Qt.rgba(97/255,97/255,97/255,1)
visible: control.text !== ""
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: icon_end.visible ? 25 : 5
rightMargin: 5
}
}
FluTextBoxMenu{
Expand Down
2 changes: 1 addition & 1 deletion src/Qt5/imports/FluentUI/Controls/FluSpinBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ T.SpinBox {
inputMethodHints: control.inputMethodHints
Rectangle{
width: parent.width
height: contentItem.activeFocus ? 3 : 1
height: contentItem.activeFocus ? 2 : 1
anchors.bottom: parent.bottom
visible: contentItem.enabled
color: {
Expand Down
5 changes: 4 additions & 1 deletion src/Qt5/imports/FluentUI/Controls/FluTableView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ Rectangle {
id:item_text
text: itemData
anchors.fill: parent
anchors.margins: 10
leftPadding: 11
rightPadding: 11
topPadding: 6
bottomPadding: 6
elide: Text.ElideRight
wrapMode: Text.WrapAnywhere
verticalAlignment: Text.AlignVCenter
Expand Down
76 changes: 39 additions & 37 deletions src/Qt5/imports/FluentUI/Controls/FluTextBox.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import FluentUI 1.0

Expand All @@ -11,11 +12,11 @@ TextField{
property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
property int iconRightMargin: icon_end.visible ? 25 : 5
property int iconRightMargin: icon_end.visible ? 40 : 5
property bool cleanEnabled: true
id:control
padding: 8
leftPadding: padding+2
padding: 7
leftPadding: padding+4
enabled: !disabled
color: {
if(!enabled){
Expand All @@ -25,7 +26,7 @@ TextField{
}
font:FluTextStyle.Body
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor:FluTools.colorAlpha(FluTheme.primaryColor.lightest,0.6)
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor.lightest,0.6)
selectedTextColor: color
placeholderTextColor: {
if(!enabled){
Expand All @@ -41,18 +42,6 @@ TextField{
background: FluTextBoxBackground{
inputItem: control
implicitWidth: 240
FluIcon{
id:icon_end
iconSource: control.iconSource
iconSize: 15
opacity: 0.5
visible: control.iconSource != 0
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: 5
}
}
}
Keys.onEnterPressed: (event)=> d.handleCommit(event)
Keys.onReturnPressed:(event)=> d.handleCommit(event)
Expand All @@ -68,34 +57,47 @@ TextField{
acceptedButtons: Qt.RightButton
onClicked: control.echoMode !== TextInput.Password && menu.popup()
}
FluIconButton{
iconSource:FluentIcons.ChromeClose
iconSize: 10
width: 20
height: 20
verticalPadding: 0
horizontalPadding: 0
visible: {
if(control.cleanEnabled === false){
return false
}
if(control.readOnly)
return false
return control.text !== ""
}
RowLayout{
height: parent.height
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: control.iconRightMargin
rightMargin: 5
}
contentDescription:"清空"
onClicked:{
control.text = ""
spacing: 4
FluIconButton{
iconSource: FluentIcons.Cancel
iconSize: 12
Layout.preferredWidth: 30
Layout.preferredHeight: 20
Layout.alignment: Qt.AlignVCenter
iconColor: FluTheme.dark ? Qt.rgba(222/255,222/255,222/255,1) : Qt.rgba(97/255,97/255,97/255,1)
verticalPadding: 0
horizontalPadding: 0
visible: {
if(control.cleanEnabled === false){
return false
}
if(control.readOnly)
return false
return control.text !== ""
}
contentDescription:"Clean"
onClicked:{
control.text = ""
}
}
FluIcon{
id:icon_end
iconSource: control.iconSource
iconSize: 12
Layout.alignment: Qt.AlignVCenter
Layout.rightMargin: 10
iconColor: FluTheme.dark ? Qt.rgba(222/255,222/255,222/255,1) : Qt.rgba(97/255,97/255,97/255,1)
visible: control.iconSource != 0
}
}
FluTextBoxMenu{
id:menu
inputItem: control
}
}

6 changes: 3 additions & 3 deletions src/Qt5/imports/FluentUI/Controls/FluTextBoxBackground.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ Rectangle{
}
Rectangle{
width: parent.width
height: inputItem.activeFocus ? 3 : 1
height: inputItem.activeFocus ? 2 : 1
anchors.bottom: parent.bottom
visible: !inputItem.disabled
color: {
if(FluTheme.dark){
inputItem.activeFocus ? FluTheme.primaryColor.lighter : Qt.rgba(166/255,166/255,166/255,1)
return inputItem.activeFocus ? FluTheme.primaryColor.lighter : Qt.rgba(166/255,166/255,166/255,1)
}else{
return inputItem.activeFocus ? FluTheme.primaryColor.dark : Qt.rgba(183/255,183/255,183/255,1)
return inputItem.activeFocus ? FluTheme.primaryColor.dark : Qt.rgba(134/255,134/255,134/255,1)
}
}
Behavior on height{
Expand Down
6 changes: 1 addition & 5 deletions src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ FluPopup {
right: parent.right
}
}

Flickable{
id:sroll_message
contentWidth: width
Expand All @@ -47,11 +46,10 @@ FluPopup {
left: parent.left
right: parent.right
}
boundsBehavior:Flickable.StopAtBounds
contentHeight: text_message.height
clip: true
height: Math.min(text_message.height,300)
ScrollBar.vertical: FluScrollBar {}

FluText{
id:text_message
font: FluTextStyle.Body
Expand All @@ -63,9 +61,7 @@ FluPopup {
rightPadding: 20
bottomPadding: 14
}

}

Rectangle{
id:layout_actions
height: 68
Expand Down
2 changes: 1 addition & 1 deletion src/Qt6/imports/FluentUI/Controls/FluMultilineTextBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ TextArea{
font:FluTextStyle.Body
wrapMode: Text.WrapAnywhere
padding: 8
leftPadding: padding+2
leftPadding: padding+4
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectedTextColor: color
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
Expand Down
25 changes: 6 additions & 19 deletions src/Qt6/imports/FluentUI/Controls/FluPasswordBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ TextField{
return normalColor
}
font:FluTextStyle.Body
padding: 8
leftPadding: padding+2
padding: 7
leftPadding: padding+4
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor.lightest,0.6)
selectedTextColor: color
placeholderTextColor: {
if(!enabled){
Expand All @@ -37,22 +37,9 @@ TextField{
return placeholderNormalColor
}
selectByMouse: true
rightPadding: icon_end.visible ? 50 : 30
background: FluTextBoxBackground{
inputItem: control
implicitWidth: 240
FluIcon{
id:icon_end
iconSource: control.iconSource
iconSize: 15
opacity: 0.5
visible: control.iconSource != 0
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: 5
}
}
}
Keys.onEnterPressed: (event)=> d.handleCommit(event)
Keys.onReturnPressed:(event)=> d.handleCommit(event)
Expand All @@ -66,16 +53,16 @@ TextField{
id:btn_reveal
iconSource:FluentIcons.RevealPasswordMedium
iconSize: 10
width: 20
width: 30
height: 20
verticalPadding: 0
horizontalPadding: 0
opacity: 0.5
iconColor: FluTheme.dark ? Qt.rgba(222/255,222/255,222/255,1) : Qt.rgba(97/255,97/255,97/255,1)
visible: control.text !== ""
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: icon_end.visible ? 25 : 5
rightMargin: 5
}
}
FluTextBoxMenu{
Expand Down
2 changes: 1 addition & 1 deletion src/Qt6/imports/FluentUI/Controls/FluSpinBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ T.SpinBox {
inputMethodHints: control.inputMethodHints
Rectangle{
width: parent.width
height: contentItem.activeFocus ? 3 : 1
height: contentItem.activeFocus ? 2 : 1
anchors.bottom: parent.bottom
visible: contentItem.enabled
color: {
Expand Down
Loading

0 comments on commit af74f35

Please sign in to comment.