mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-01-22 20:04:32 +08:00
FluExpander 添加属性 headerHeight 和 headerDelegate
- 使 FluExpander 支持自定义非展开状态下 header 的高度和内容 - 在 example 添加对应的使用例子
This commit is contained in:
parent
a8ca78f3f1
commit
cd6a46c22e
@ -1314,6 +1314,26 @@ Since that moment, I have been tormented day and night by the fear that I might
|
|||||||
My only desire is to be permitted to drive out the traitors and restore the Han. If I should let you down, punish my offense and report it to the spirit of the late Emperor. If those three advisors should fail in their duties, then they should be punished for their negligence.Your Majesty, consider your course of action carefully. Seek out good advice, and never forget the late Emperor. I depart now on a long expedition, and I will be forever grateful if you heed my advice. Blinded by my own tears, I know not what I write.</source>
|
My only desire is to be permitted to drive out the traitors and restore the Han. If I should let you down, punish my offense and report it to the spirit of the late Emperor. If those three advisors should fail in their duties, then they should be punished for their negligence.Your Majesty, consider your course of action carefully. Seek out good advice, and never forget the late Emperor. I depart now on a long expedition, and I will be forever grateful if you heed my advice. Blinded by my own tears, I know not what I write.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_Expander.qml" line="152"/>
|
||||||
|
<source>Check for Updates</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_Expander.qml" line="207"/>
|
||||||
|
<source>This is a ToggleButton in the header</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_Expander.qml" line="215"/>
|
||||||
|
<source>This is a StandardButton in the content</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_Expander.qml" line="217"/>
|
||||||
|
<source>Click StandardButton</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>T_FlipView</name>
|
<name>T_FlipView</name>
|
||||||
|
@ -1432,6 +1432,26 @@ Since that moment, I have been tormented day and night by the fear that I might
|
|||||||
My only desire is to be permitted to drive out the traitors and restore the Han. If I should let you down, punish my offense and report it to the spirit of the late Emperor. If those three advisors should fail in their duties, then they should be punished for their negligence.Your Majesty, consider your course of action carefully. Seek out good advice, and never forget the late Emperor. I depart now on a long expedition, and I will be forever grateful if you heed my advice. Blinded by my own tears, I know not what I write.</oldsource>
|
My only desire is to be permitted to drive out the traitors and restore the Han. If I should let you down, punish my offense and report it to the spirit of the late Emperor. If those three advisors should fail in their duties, then they should be punished for their negligence.Your Majesty, consider your course of action carefully. Seek out good advice, and never forget the late Emperor. I depart now on a long expedition, and I will be forever grateful if you heed my advice. Blinded by my own tears, I know not what I write.</oldsource>
|
||||||
<translation type="unfinished">先帝创业未半而中道崩殂,今天下三分,益州疲弊,此诚危急存亡之秋也。然侍卫之臣不懈于内,忠志之士忘身于外者,盖追先帝之殊遇,欲报之于陛下也。诚宜开张圣听,以光先帝遗德,恢弘志士之气,不宜妄自菲薄,引喻失义,以塞忠谏之路也。宫中府中,俱为一体;陟罚臧否,不宜异同。若有作奸犯科及为忠善者,宜付有司论其刑赏,以昭陛下平明之理,不宜偏私,使内外异法也。侍中、侍郎郭攸之、费祎、董允等,此皆良实,志虑忠纯,是以先帝简拔以遗陛下。愚以为宫中之事,事无大小,悉以咨之,然后施行,必能裨补阙漏,有所广益。将军向宠,性行淑均,晓畅军事,试用于昔日,先帝称之曰能,是以众议举宠为督。愚以为营中之事,悉以咨之,必能使行阵和睦,优劣得所。亲贤臣,远小人,此先汉所以兴隆也;亲小人,远贤臣,此后汉所以倾颓也。先帝在时,每与臣论此事,未尝不叹息痛恨于桓、灵也。侍中、尚书、长史、参军,此悉贞良死节之臣,愿陛下亲之信之,则汉室之隆,可计日而待也。臣本布衣,躬耕于南阳,苟全性命于乱世,不求闻达于诸侯。先帝不以臣卑鄙,猥自枉屈,三顾臣于草庐之中,咨臣以当世之事,由是感激,遂许先帝以驱驰。后值倾覆,受任于败军之际,奉命于危难之间,尔来二十有一年矣。先帝知臣谨慎,故临崩寄臣以大事也。受命以来,夙夜忧叹,恐托付不效,以伤先帝之明;故五月渡泸,深入不毛。今南方已定,兵甲已足,当奖率三军,北定中原,庶竭驽钝,攘除奸凶,兴复汉室,还于旧都。此臣所以报先帝而忠陛下之职分也。至于斟酌损益,进尽忠言,则攸之、祎、允之任也。愿陛下托臣以讨贼兴复之效,不效,则治臣之罪,以告先帝之灵。若无兴德之言,则责攸之、祎、允等之慢,以彰其咎;陛下亦宜自谋,以咨诹善道,察纳雅言,深追先帝遗诏。臣不胜受恩感激。今当远离,临表涕零,不知所言。</translation>
|
<translation type="unfinished">先帝创业未半而中道崩殂,今天下三分,益州疲弊,此诚危急存亡之秋也。然侍卫之臣不懈于内,忠志之士忘身于外者,盖追先帝之殊遇,欲报之于陛下也。诚宜开张圣听,以光先帝遗德,恢弘志士之气,不宜妄自菲薄,引喻失义,以塞忠谏之路也。宫中府中,俱为一体;陟罚臧否,不宜异同。若有作奸犯科及为忠善者,宜付有司论其刑赏,以昭陛下平明之理,不宜偏私,使内外异法也。侍中、侍郎郭攸之、费祎、董允等,此皆良实,志虑忠纯,是以先帝简拔以遗陛下。愚以为宫中之事,事无大小,悉以咨之,然后施行,必能裨补阙漏,有所广益。将军向宠,性行淑均,晓畅军事,试用于昔日,先帝称之曰能,是以众议举宠为督。愚以为营中之事,悉以咨之,必能使行阵和睦,优劣得所。亲贤臣,远小人,此先汉所以兴隆也;亲小人,远贤臣,此后汉所以倾颓也。先帝在时,每与臣论此事,未尝不叹息痛恨于桓、灵也。侍中、尚书、长史、参军,此悉贞良死节之臣,愿陛下亲之信之,则汉室之隆,可计日而待也。臣本布衣,躬耕于南阳,苟全性命于乱世,不求闻达于诸侯。先帝不以臣卑鄙,猥自枉屈,三顾臣于草庐之中,咨臣以当世之事,由是感激,遂许先帝以驱驰。后值倾覆,受任于败军之际,奉命于危难之间,尔来二十有一年矣。先帝知臣谨慎,故临崩寄臣以大事也。受命以来,夙夜忧叹,恐托付不效,以伤先帝之明;故五月渡泸,深入不毛。今南方已定,兵甲已足,当奖率三军,北定中原,庶竭驽钝,攘除奸凶,兴复汉室,还于旧都。此臣所以报先帝而忠陛下之职分也。至于斟酌损益,进尽忠言,则攸之、祎、允之任也。愿陛下托臣以讨贼兴复之效,不效,则治臣之罪,以告先帝之灵。若无兴德之言,则责攸之、祎、允等之慢,以彰其咎;陛下亦宜自谋,以咨诹善道,察纳雅言,深追先帝遗诏。臣不胜受恩感激。今当远离,临表涕零,不知所言。</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_Expander.qml" line="152"/>
|
||||||
|
<source>Check for Updates</source>
|
||||||
|
<translation type="unfinished">检查更新</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_Expander.qml" line="207"/>
|
||||||
|
<source>This is a ToggleButton in the header</source>
|
||||||
|
<translation type="unfinished">这是一个位于头部的开关按钮</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_Expander.qml" line="215"/>
|
||||||
|
<source>This is a StandardButton in the content</source>
|
||||||
|
<translation type="unfinished">这是一个位于内容的标准按钮</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_Expander.qml" line="217"/>
|
||||||
|
<source>Click StandardButton</source>
|
||||||
|
<translation type="unfinished">点击标准按钮</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>T_FlipView</name>
|
<name>T_FlipView</name>
|
||||||
|
@ -105,5 +105,147 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
|
|||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluFrame {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
padding: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
Column {
|
||||||
|
spacing: 15
|
||||||
|
FluExpander {
|
||||||
|
headerHeight: 60
|
||||||
|
contentHeight: content_layout.implicitHeight
|
||||||
|
headerDelegate: Component {
|
||||||
|
Item {
|
||||||
|
RowLayout {
|
||||||
|
anchors {
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: 15
|
||||||
|
}
|
||||||
|
spacing: 15
|
||||||
|
FluImage {
|
||||||
|
width: 20
|
||||||
|
height: 20
|
||||||
|
sourceSize.width: 20
|
||||||
|
sourceSize.height: 20
|
||||||
|
source: "qrc:/example/res/image/favicon.ico"
|
||||||
|
}
|
||||||
|
ColumnLayout {
|
||||||
|
spacing: 0
|
||||||
|
FluText {
|
||||||
|
text: "FluentUI"
|
||||||
|
}
|
||||||
|
FluText {
|
||||||
|
text: "%1".arg(AppInfo.version)
|
||||||
|
textColor: FluTheme.fontSecondaryColor
|
||||||
|
font.pixelSize: 12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluLoadingButton {
|
||||||
|
id: btn_checkupdate
|
||||||
|
anchors {
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: 15
|
||||||
|
}
|
||||||
|
text: qsTr("Check for Updates")
|
||||||
|
onClicked: {
|
||||||
|
loading = true;
|
||||||
|
FluEventBus.post("checkUpdate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluEvent {
|
||||||
|
name: "checkUpdateFinish"
|
||||||
|
onTriggered: {
|
||||||
|
btn_checkupdate.loading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
content: ColumnLayout {
|
||||||
|
id: content_layout
|
||||||
|
spacing: 0
|
||||||
|
RowLayout {
|
||||||
|
Layout.topMargin: 15
|
||||||
|
Layout.leftMargin: 15
|
||||||
|
spacing: 0
|
||||||
|
FluText {
|
||||||
|
text: "GitHub: "
|
||||||
|
}
|
||||||
|
FluTextButton {
|
||||||
|
text: "https://github.com/zhuzichu520/FluentUI"
|
||||||
|
onClicked: {
|
||||||
|
Qt.openUrlExternally(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RowLayout {
|
||||||
|
Layout.bottomMargin: 15
|
||||||
|
Layout.leftMargin: 15
|
||||||
|
spacing: 0
|
||||||
|
FluText {
|
||||||
|
text: "bilibili: "
|
||||||
|
}
|
||||||
|
FluTextButton {
|
||||||
|
text: "https://www.bilibili.com/video/BV1mg4y1M71w"
|
||||||
|
onClicked: {
|
||||||
|
Qt.openUrlExternally(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluExpander {
|
||||||
|
contentHeight: 100
|
||||||
|
headerHeight: 45
|
||||||
|
headerDelegate: Component {
|
||||||
|
Item {
|
||||||
|
FluToggleButton {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: qsTr("This is a ToggleButton in the header")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
content: Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
FluButton {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: qsTr("This is a StandardButton in the content")
|
||||||
|
onClicked: {
|
||||||
|
showInfo(qsTr("Click StandardButton"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeExpander {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -6
|
||||||
|
code: 'FluExpander {
|
||||||
|
contentHeight: 100
|
||||||
|
headerHeight: 45
|
||||||
|
headerDelegate: Component {
|
||||||
|
Item {
|
||||||
|
FluToggleButton {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: qsTr("This is a ToggleButton in the header")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
content: Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
FluButton {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: qsTr("This is a StandardButton in the content")
|
||||||
|
onClicked: {
|
||||||
|
showInfo(qsTr("Click StandardButton"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import FluentUI 1.0
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
property string headerText: ""
|
property string headerText: ""
|
||||||
|
property int headerHeight : 45
|
||||||
|
property Component headerDelegate: com_header
|
||||||
property bool expand: false
|
property bool expand: false
|
||||||
property int contentHeight : 300
|
property int contentHeight : 300
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
@ -21,10 +23,23 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
clip: true
|
clip: true
|
||||||
|
Component {
|
||||||
|
id: com_header
|
||||||
|
Item {
|
||||||
|
FluText {
|
||||||
|
text: control.headerText
|
||||||
|
anchors {
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: 15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id:layout_header
|
id:layout_header
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 45
|
height: control.headerHeight
|
||||||
radius: 4
|
radius: 4
|
||||||
border.color: FluTheme.dividerColor
|
border.color: FluTheme.dividerColor
|
||||||
color: {
|
color: {
|
||||||
@ -41,15 +56,17 @@ Item {
|
|||||||
d.toggle()
|
d.toggle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText{
|
FluLoader {
|
||||||
text: headerText
|
anchors {
|
||||||
anchors{
|
top: parent.top
|
||||||
verticalCenter: parent.verticalCenter
|
bottom: parent.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: 15
|
right: btn_toggle.left
|
||||||
}
|
}
|
||||||
|
sourceComponent: control.headerDelegate
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
|
id: btn_toggle
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
@ -5,6 +5,8 @@ import FluentUI
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
property string headerText: ""
|
property string headerText: ""
|
||||||
|
property int headerHeight : 45
|
||||||
|
property Component headerDelegate: com_header
|
||||||
property bool expand: false
|
property bool expand: false
|
||||||
property int contentHeight : 300
|
property int contentHeight : 300
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
@ -21,10 +23,23 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
clip: true
|
clip: true
|
||||||
|
Component {
|
||||||
|
id: com_header
|
||||||
|
Item {
|
||||||
|
FluText {
|
||||||
|
text: control.headerText
|
||||||
|
anchors {
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: 15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id:layout_header
|
id:layout_header
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 45
|
height: control.headerHeight
|
||||||
radius: 4
|
radius: 4
|
||||||
border.color: FluTheme.dividerColor
|
border.color: FluTheme.dividerColor
|
||||||
color: {
|
color: {
|
||||||
@ -41,15 +56,17 @@ Item {
|
|||||||
d.toggle()
|
d.toggle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText{
|
FluLoader {
|
||||||
text: headerText
|
anchors {
|
||||||
anchors{
|
top: parent.top
|
||||||
verticalCenter: parent.verticalCenter
|
bottom: parent.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: 15
|
right: btn_toggle.left
|
||||||
}
|
}
|
||||||
|
sourceComponent: control.headerDelegate
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
|
id: btn_toggle
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
@ -355,8 +355,8 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>FluWindow</name>
|
<name>FluWindow</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="Qt5/imports/FluentUI/Controls/FluWindow.qml" line="354"/>
|
<location filename="Qt5/imports/FluentUI/Controls/FluWindow.qml" line="375"/>
|
||||||
<location filename="Qt6/imports/FluentUI/Controls/FluWindow.qml" line="354"/>
|
<location filename="Qt6/imports/FluentUI/Controls/FluWindow.qml" line="374"/>
|
||||||
<source>Loading...</source>
|
<source>Loading...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -355,8 +355,8 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>FluWindow</name>
|
<name>FluWindow</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="Qt5/imports/FluentUI/Controls/FluWindow.qml" line="354"/>
|
<location filename="Qt5/imports/FluentUI/Controls/FluWindow.qml" line="375"/>
|
||||||
<location filename="Qt6/imports/FluentUI/Controls/FluWindow.qml" line="354"/>
|
<location filename="Qt6/imports/FluentUI/Controls/FluWindow.qml" line="374"/>
|
||||||
<source>Loading...</source>
|
<source>Loading...</source>
|
||||||
<translation type="unfinished">加载中...</translation>
|
<translation type="unfinished">加载中...</translation>
|
||||||
</message>
|
</message>
|
||||||
|
Loading…
Reference in New Issue
Block a user