2023-05-22 16:17:51 +08:00
|
|
|
import QtQuick
|
2023-03-30 21:52:55 +08:00
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Window
|
|
|
|
import FluentUI
|
2023-06-12 16:46:02 +08:00
|
|
|
import "qrc:///example/qml/component"
|
2023-03-27 18:24:35 +08:00
|
|
|
|
|
|
|
FluScrollablePage{
|
|
|
|
|
2023-03-30 11:43:35 +08:00
|
|
|
property var colors : [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
|
|
|
|
|
2023-05-11 18:24:58 +08:00
|
|
|
title:"TabView"
|
|
|
|
|
2023-03-27 22:58:33 +08:00
|
|
|
Component{
|
|
|
|
id:com_page
|
|
|
|
Rectangle{
|
|
|
|
anchors.fill: parent
|
|
|
|
color: argument
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-30 11:43:35 +08:00
|
|
|
function newTab(){
|
2023-04-27 09:38:57 +08:00
|
|
|
tab_view.appendTab("qrc:/example/res/image/favicon.ico","Document "+tab_view.count(),com_page,colors[Math.floor(Math.random() * 8)].dark)
|
2023-03-30 11:43:35 +08:00
|
|
|
}
|
|
|
|
|
2023-03-27 22:58:33 +08:00
|
|
|
Component.onCompleted: {
|
2023-03-30 11:43:35 +08:00
|
|
|
newTab()
|
|
|
|
newTab()
|
|
|
|
newTab()
|
2023-03-27 22:58:33 +08:00
|
|
|
}
|
2023-03-27 18:24:35 +08:00
|
|
|
|
|
|
|
FluArea{
|
2023-04-03 09:32:06 +08:00
|
|
|
Layout.fillWidth: true
|
2023-03-27 18:24:35 +08:00
|
|
|
Layout.topMargin: 20
|
2023-03-30 11:43:35 +08:00
|
|
|
height: 50
|
2023-03-27 18:24:35 +08:00
|
|
|
paddings: 10
|
2023-03-30 11:43:35 +08:00
|
|
|
RowLayout{
|
|
|
|
spacing: 14
|
|
|
|
FluDropDownButton{
|
|
|
|
id:btn_tab_width_behavior
|
|
|
|
Layout.preferredWidth: 140
|
|
|
|
text:"Equal"
|
2023-06-18 13:56:30 +08:00
|
|
|
FluMenuItem{
|
|
|
|
text:"Equal"
|
|
|
|
onClicked: {
|
|
|
|
btn_tab_width_behavior.text = text
|
|
|
|
tab_view.tabWidthBehavior = FluTabView.Equal
|
2023-03-30 11:43:35 +08:00
|
|
|
}
|
2023-06-18 13:56:30 +08:00
|
|
|
}
|
|
|
|
FluMenuItem{
|
|
|
|
text:"SizeToContent"
|
|
|
|
onClicked: {
|
|
|
|
btn_tab_width_behavior.text = text
|
|
|
|
tab_view.tabWidthBehavior = FluTabView.SizeToContent
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluMenuItem{
|
|
|
|
text:"Compact"
|
|
|
|
onClicked: {
|
|
|
|
btn_tab_width_behavior.text = text
|
|
|
|
tab_view.tabWidthBehavior = FluTabView.Compact
|
|
|
|
}
|
|
|
|
}
|
2023-03-30 11:43:35 +08:00
|
|
|
}
|
|
|
|
FluDropDownButton{
|
|
|
|
id:btn_close_button_visibility
|
|
|
|
text:"Always"
|
2023-04-03 09:32:06 +08:00
|
|
|
Layout.preferredWidth: 120
|
2023-06-18 13:56:30 +08:00
|
|
|
FluMenuItem{
|
|
|
|
text:"Nerver"
|
|
|
|
onClicked: {
|
|
|
|
btn_close_button_visibility.text = text
|
|
|
|
tab_view.closeButtonVisibility = FluTabView.Nerver
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluMenuItem{
|
|
|
|
text:"Always"
|
|
|
|
onClicked: {
|
|
|
|
btn_close_button_visibility.text = text
|
|
|
|
tab_view.closeButtonVisibility = FluTabView.Always
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluMenuItem{
|
|
|
|
text:"OnHover"
|
|
|
|
onClicked: {
|
|
|
|
btn_close_button_visibility.text = text
|
|
|
|
tab_view.closeButtonVisibility = FluTabView.OnHover
|
2023-03-30 11:43:35 +08:00
|
|
|
}
|
2023-06-18 13:56:30 +08:00
|
|
|
}
|
2023-03-30 11:43:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-27 18:24:35 +08:00
|
|
|
|
2023-03-30 11:43:35 +08:00
|
|
|
FluArea{
|
2023-04-03 09:32:06 +08:00
|
|
|
Layout.fillWidth: true
|
2023-04-06 17:32:21 +08:00
|
|
|
Layout.topMargin: 15
|
2023-03-30 11:43:35 +08:00
|
|
|
height: 400
|
|
|
|
paddings: 10
|
2023-03-27 18:24:35 +08:00
|
|
|
FluTabView{
|
2023-03-27 22:58:33 +08:00
|
|
|
id:tab_view
|
2023-03-30 11:43:35 +08:00
|
|
|
onNewPressed:{
|
|
|
|
newTab()
|
|
|
|
}
|
2023-03-27 18:24:35 +08:00
|
|
|
}
|
|
|
|
}
|
2023-04-06 17:32:21 +08:00
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
2023-04-19 17:25:46 +08:00
|
|
|
Layout.topMargin: -1
|
2023-04-06 17:32:21 +08:00
|
|
|
code:'FluTabView{
|
|
|
|
anchors.fill: parent
|
|
|
|
Component.onCompleted: {
|
|
|
|
newTab()
|
|
|
|
newTab()
|
|
|
|
newTab()
|
|
|
|
}
|
|
|
|
Component{
|
|
|
|
id:com_page
|
|
|
|
Rectangle{
|
|
|
|
anchors.fill: parent
|
|
|
|
color: argument
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function newTab(){
|
2023-04-27 09:38:57 +08:00
|
|
|
tab_view.appendTab("qrc:/example/res/image/favicon.ico","Document 1",com_page,argument)
|
2023-04-06 17:32:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
'
|
|
|
|
}
|
2023-03-27 18:24:35 +08:00
|
|
|
|
|
|
|
}
|