update
parent
3fbd494724
commit
818b588daa
|
@ -55,6 +55,10 @@ FluWindow {
|
||||||
text:"Rectangle"
|
text:"Rectangle"
|
||||||
page:"qrc:/T_Rectangle.qml"
|
page:"qrc:/T_Rectangle.qml"
|
||||||
}
|
}
|
||||||
|
ListElement{
|
||||||
|
text:"Expander"
|
||||||
|
page:"qrc:/T_Expander.qml"
|
||||||
|
}
|
||||||
ListElement{
|
ListElement{
|
||||||
text:"TreeView"
|
text:"TreeView"
|
||||||
page:"qrc:/T_TreeView.qml"
|
page:"qrc:/T_TreeView.qml"
|
||||||
|
@ -111,6 +115,7 @@ FluWindow {
|
||||||
topMargin: 20
|
topMargin: 20
|
||||||
bottomMargin: 52
|
bottomMargin: 52
|
||||||
}
|
}
|
||||||
|
ScrollBar.vertical: ScrollBar { }
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
clip: true
|
clip: true
|
||||||
width: 160
|
width: 160
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
import QtQuick 2.15
|
||||||
|
import QtQuick.Controls 2.15
|
||||||
|
import QtQuick.Layouts 1.15
|
||||||
|
import QtQuick.Window 2.15
|
||||||
|
import QtGraphicalEffects 1.15
|
||||||
|
import FluentUI 1.0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
FluText{
|
||||||
|
id:title
|
||||||
|
text:"Expander"
|
||||||
|
fontStyle: FluText.TitleLarge
|
||||||
|
}
|
||||||
|
ScrollView{
|
||||||
|
clip: true
|
||||||
|
width: parent.width
|
||||||
|
contentWidth: parent.width
|
||||||
|
anchors{
|
||||||
|
top: title.bottom
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
|
Column{
|
||||||
|
spacing: 5
|
||||||
|
Item{
|
||||||
|
width: 1
|
||||||
|
height: 20
|
||||||
|
}
|
||||||
|
FluExpander{
|
||||||
|
headerText:"打开一个单选框"
|
||||||
|
Item{
|
||||||
|
anchors.fill: parent
|
||||||
|
ColumnLayout{
|
||||||
|
spacing: 8
|
||||||
|
anchors{
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
topMargin: 15
|
||||||
|
leftMargin: 15
|
||||||
|
}
|
||||||
|
Repeater{
|
||||||
|
id:repeater
|
||||||
|
property int selecIndex : 0
|
||||||
|
model: 3
|
||||||
|
delegate: FluRadioButton{
|
||||||
|
checked : repeater.selecIndex===index
|
||||||
|
text:"RodioButton_"+index
|
||||||
|
onClicked:{
|
||||||
|
repeater.selecIndex = index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluExpander{
|
||||||
|
Layout.topMargin: 20
|
||||||
|
headerText:"打开一个滑动文本框"
|
||||||
|
Item{
|
||||||
|
anchors.fill: parent
|
||||||
|
ScrollView{
|
||||||
|
id:scrollview
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
contentWidth: parent.width
|
||||||
|
FluText{
|
||||||
|
id:test
|
||||||
|
width: scrollview.width
|
||||||
|
wrapMode: Text.WrapAnywhere
|
||||||
|
padding: 14
|
||||||
|
text:"先帝创业未半而中道崩殂,今天下三分,益州疲弊,此诚危急存亡之秋也。然侍卫之臣不懈于内,忠志之士忘身于外者,盖追先帝之殊遇,欲报之于陛下也。诚宜开张圣听,以光先帝遗德,恢弘志士之气,不宜妄自菲薄,引喻失义,以塞忠谏之路也。宫中府中,俱为一体;陟罚臧否,不宜异同。若有作奸犯科及为忠善者,宜付有司论其刑赏,以昭陛下平明之理,不宜偏私,使内外异法也。侍中、侍郎郭攸之、费祎、董允等,此皆良实,志虑忠纯,是以先帝简拔以遗陛下。愚以为宫中之事,事无大小,悉以咨之,然后施行,必能裨补阙漏,有所广益。将军向宠,性行淑均,晓畅军事,试用于昔日,先帝称之曰能,是以众议举宠为督。愚以为营中之事,悉以咨之,必能使行阵和睦,优劣得所。亲贤臣,远小人,此先汉所以兴隆也;亲小人,远贤臣,此后汉所以倾颓也。先帝在时,每与臣论此事,未尝不叹息痛恨于桓、灵也。侍中、尚书、长史、参军,此悉贞良死节之臣,愿陛下亲之信之,则汉室之隆,可计日而待也。臣本布衣,躬耕于南阳,苟全性命于乱世,不求闻达于诸侯。先帝不以臣卑鄙,猥自枉屈,三顾臣于草庐之中,咨臣以当世之事,由是感激,遂许先帝以驱驰。后值倾覆,受任于败军之际,奉命于危难之间,尔来二十有一年矣。先帝知臣谨慎,故临崩寄臣以大事也。受命以来,夙夜忧叹,恐托付不效,以伤先帝之明;故五月渡泸,深入不毛。今南方已定,兵甲已足,当奖率三军,北定中原,庶竭驽钝,攘除奸凶,兴复汉室,还于旧都。此臣所以报先帝而忠陛下之职分也。至于斟酌损益,进尽忠言,则攸之、祎、允之任也。愿陛下托臣以讨贼兴复之效,不效,则治臣之罪,以告先帝之灵。若无兴德之言,则责攸之、祎、允等之慢,以彰其咎;陛下亦宜自谋,以咨诹善道,察纳雅言,深追先帝遗诏。臣不胜受恩感激。今当远离,临表涕零,不知所言。"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,5 +29,6 @@
|
||||||
<file>T_Theme.qml</file>
|
<file>T_Theme.qml</file>
|
||||||
<file>T_Dialog.qml</file>
|
<file>T_Dialog.qml</file>
|
||||||
<file>T_TreeView.qml</file>
|
<file>T_TreeView.qml</file>
|
||||||
|
<file>T_Expander.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -33,6 +33,7 @@ void Fluent::registerTypes(const char *uri){
|
||||||
qmlRegisterType<WindowHelper>(uri,major,minor,"WindowHelper");
|
qmlRegisterType<WindowHelper>(uri,major,minor,"WindowHelper");
|
||||||
qmlRegisterType<FluColorSet>(uri,major,minor,"FluColorSet");
|
qmlRegisterType<FluColorSet>(uri,major,minor,"FluColorSet");
|
||||||
|
|
||||||
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluExpander.qml"),uri,major,minor,"FluExpander");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTreeView.qml"),uri,major,minor,"FluTreeView");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTreeView.qml"),uri,major,minor,"FluTreeView");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluContentDialog.qml"),uri,major,minor,"FluContentDialog");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluContentDialog.qml"),uri,major,minor,"FluContentDialog");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluMenuItem.qml"),uri,major,minor,"FluMenuItem");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluMenuItem.qml"),uri,major,minor,"FluMenuItem");
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
import QtQuick 2.15
|
||||||
|
import FluentUI 1.0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
|
||||||
|
|
||||||
|
property string headerText: "Titlte"
|
||||||
|
property bool expand: false
|
||||||
|
|
||||||
|
id:root
|
||||||
|
height: layout_header.height + container.height
|
||||||
|
width: 400
|
||||||
|
|
||||||
|
property int contentHeight : 300
|
||||||
|
|
||||||
|
default property alias content: container.data
|
||||||
|
|
||||||
|
Rectangle{
|
||||||
|
id:layout_header
|
||||||
|
width: parent.width
|
||||||
|
height: 50
|
||||||
|
radius: 4
|
||||||
|
border.color: FluTheme.isDark ? Qt.rgba(53/255,53/255,53/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
||||||
|
color: FluTheme.isDark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||||
|
|
||||||
|
|
||||||
|
MouseArea{
|
||||||
|
id:root_mouse
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
onClicked: {
|
||||||
|
expand = !expand
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluText{
|
||||||
|
text: headerText
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: 15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluIconButton{
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: 15
|
||||||
|
}
|
||||||
|
hoverColor: FluTheme.isDark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(245/255,245/255,245/255,1)
|
||||||
|
normalColor: FluTheme.isDark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||||
|
hovered: root_mouse.containsMouse
|
||||||
|
icon: expand ? FluentIcons.FA_angle_up : FluentIcons.FA_angle_down
|
||||||
|
onClicked: {
|
||||||
|
expand = !expand
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Rectangle{
|
||||||
|
id:container
|
||||||
|
width: parent.width
|
||||||
|
clip: true
|
||||||
|
anchors{
|
||||||
|
top: layout_header.bottom
|
||||||
|
left: layout_header.left
|
||||||
|
}
|
||||||
|
radius: 4
|
||||||
|
border.color: FluTheme.isDark ? Qt.rgba(53/255,53/255,53/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
||||||
|
color: FluTheme.isDark ? Qt.rgba(57/255,57/255,57/255,1) : Qt.rgba(249/255,249/255,249/255,1)
|
||||||
|
height: expand ? contentHeight : 0
|
||||||
|
Behavior on height {
|
||||||
|
NumberAnimation{
|
||||||
|
duration: 150
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -13,6 +13,11 @@ Rectangle {
|
||||||
signal clicked
|
signal clicked
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property bool hovered: button_mouse.containsMouse
|
property bool hovered: button_mouse.containsMouse
|
||||||
|
|
||||||
|
property color hoverColor: FluTheme.isDark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(244/255,244/255,244/255,1)
|
||||||
|
property color normalColor: FluTheme.isDark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(1,1,1,1)
|
||||||
|
property color disableColor: FluTheme.isDark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(1,1,1,1)
|
||||||
|
|
||||||
property color textColor: {
|
property color textColor: {
|
||||||
if(FluTheme.isDark){
|
if(FluTheme.isDark){
|
||||||
if(disabled){
|
if(disabled){
|
||||||
|
@ -29,17 +34,10 @@ Rectangle {
|
||||||
radius: 4
|
radius: 4
|
||||||
|
|
||||||
color: {
|
color: {
|
||||||
if(FluTheme.isDark){
|
if(disabled){
|
||||||
if(disabled){
|
return disableColor
|
||||||
return Qt.rgba(59/255,59/255,59/255,1)
|
|
||||||
}
|
|
||||||
return button_mouse.containsMouse ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(50/255,50/255,50/255,1)
|
|
||||||
}else{
|
|
||||||
if(disabled){
|
|
||||||
return Qt.rgba(1,1,1,1)
|
|
||||||
}
|
|
||||||
return button_mouse.containsMouse ? Qt.rgba(244/255,244/255,244/255,1) : Qt.rgba(1,1,1,1)
|
|
||||||
}
|
}
|
||||||
|
return (hovered || button_mouse.containsMouse) ? hoverColor : normalColor
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
@ -69,7 +67,7 @@ Rectangle {
|
||||||
if(button.text === ""){
|
if(button.text === ""){
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return button_mouse.containsMouse
|
return (hovered || button_mouse.containsMouse)
|
||||||
}
|
}
|
||||||
delay: 1000
|
delay: 1000
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,5 +34,6 @@
|
||||||
<file>controls/FluTextButton.qml</file>
|
<file>controls/FluTextButton.qml</file>
|
||||||
<file>controls/FluContentDialog.qml</file>
|
<file>controls/FluContentDialog.qml</file>
|
||||||
<file>controls/FluTreeView.qml</file>
|
<file>controls/FluTreeView.qml</file>
|
||||||
|
<file>controls/FluExpander.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Loading…
Reference in New Issue