Compare commits

...

3 Commits

Author SHA1 Message Date
朱子楚\zhuzi 72cf0311c0 update 2024-03-18 22:48:13 +08:00
朱子楚\zhuzi 1a6c53d0ce update 2024-03-18 22:26:22 +08:00
朱子楚\zhuzi 77bb12b164 update 2024-03-18 22:11:39 +08:00
5 changed files with 75 additions and 32 deletions

View File

@ -32,6 +32,30 @@ FluScrollablePage{
} }
} }
FluArea {
Layout.fillWidth: true
height: 80
paddings: 5
Layout.topMargin: 20
Column{
spacing: 5
anchors.verticalCenter: parent.verticalCenter
FluText{
text: "disabled=true"
x:10
}
FluComboBox {
disabled: true
model: ListModel {
id: model_2
ListElement { text: "Banana" }
ListElement { text: "Apple" }
ListElement { text: "Coconut" }
}
}
}
}
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
height: 80 height: 80
@ -47,14 +71,14 @@ FluScrollablePage{
FluComboBox { FluComboBox {
editable: true editable: true
model: ListModel { model: ListModel {
id: model_2 id: model_3
ListElement { text: "Banana" } ListElement { text: "Banana" }
ListElement { text: "Apple" } ListElement { text: "Apple" }
ListElement { text: "Coconut" } ListElement { text: "Coconut" }
} }
onAccepted: { onAccepted: {
if (find(editText) === -1) if (find(editText) === -1)
model_2.append({text: editText}) model_3.append({text: editText})
} }
} }
} }

View File

@ -52,7 +52,12 @@ T.ComboBox {
autoScroll: control.editable autoScroll: control.editable
font:control.font font:control.font
readOnly: control.down readOnly: control.down
color: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1) color: {
if(control.disabled) {
return FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
}
return FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
}
inputMethodHints: control.inputMethodHints inputMethodHints: control.inputMethodHints
validator: control.validator validator: control.validator
selectByMouse: true selectByMouse: true
@ -75,7 +80,6 @@ T.ComboBox {
accepted() accepted()
} }
} }
background: Rectangle { background: Rectangle {
implicitWidth: 140 implicitWidth: 140
implicitHeight: 32 implicitHeight: 32
@ -95,7 +99,6 @@ T.ComboBox {
return hovered ? hoverColor :normalColor return hovered ? hoverColor :normalColor
} }
} }
popup: T.Popup { popup: T.Popup {
y: control.height y: control.height
width: control.width width: control.width

View File

@ -341,12 +341,9 @@ Rectangle {
} }
TableView { TableView {
id:table_view id:table_view
ListModel{
id:model_columns
}
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
anchors.fill: parent anchors.fill: parent
contentX: header_horizontal.contentX ScrollBar.horizontal:scroll_bar_h
ScrollBar.vertical:scroll_bar_v ScrollBar.vertical:scroll_bar_v
columnWidthProvider: function(column) { columnWidthProvider: function(column) {
var columnObject = d.columns_data[column] var columnObject = d.columns_data[column]
@ -731,9 +728,10 @@ Rectangle {
height: visible ? Math.max(1, contentHeight) : 0 height: visible ? Math.max(1, contentHeight) : 0
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
clip: true clip: true
contentX: table_view.contentX syncDirection: Qt.Horizontal
ScrollBar.horizontal:scroll_bar_h_2
columnWidthProvider: table_view.columnWidthProvider columnWidthProvider: table_view.columnWidthProvider
ScrollBar.horizontal:scroll_bar_h syncView: table_view.rows === 0 ? null : table_view
onContentXChanged:{ onContentXChanged:{
timer_horizontal_force_layout.restart() timer_horizontal_force_layout.restart()
} }
@ -760,15 +758,16 @@ Rectangle {
syncView: table_view syncView: table_view
clip: true clip: true
model: header_row_model model: header_row_model
delegate: com_row_header_delegate
onContentYChanged:{
timer_vertical_force_layout.restart()
}
Connections{ Connections{
target: table_model target: table_model
function onRowCountChanged(){ function onRowCountChanged(){
header_row_model.rows = Array.from({length: table_model.rows.length}, (_, i) => ({rowIndex:i+1})) header_row_model.rows = Array.from({length: table_model.rows.length}, (_, i) => ({rowIndex:i+1}))
} }
} }
onContentYChanged:{
timer_vertical_force_layout.restart()
}
Timer{ Timer{
id:timer_vertical_force_layout id:timer_vertical_force_layout
interval: 50 interval: 50
@ -776,19 +775,29 @@ Rectangle {
header_vertical.forceLayout() header_vertical.forceLayout()
} }
} }
delegate: com_row_header_delegate
} }
FluScrollBar { FluScrollBar {
id:scroll_bar_h id: scroll_bar_h
anchors{ anchors{
left: layout_mouse_table.left left: layout_mouse_table.left
right: parent.right right: parent.right
bottom: layout_mouse_table.bottom bottom: layout_mouse_table.bottom
} }
visible: table_view.rows !== 0
z:999 z:999
} }
FluScrollBar { FluScrollBar {
id:scroll_bar_v id: scroll_bar_h_2
anchors{
left: layout_mouse_table.left
right: parent.right
bottom: layout_mouse_table.bottom
}
visible: table_view.rows === 0
z:999
}
FluScrollBar {
id: scroll_bar_v
anchors{ anchors{
top: layout_mouse_table.top top: layout_mouse_table.top
bottom: layout_mouse_table.bottom bottom: layout_mouse_table.bottom

View File

@ -80,7 +80,6 @@ T.ComboBox {
accepted() accepted()
} }
} }
background: Rectangle { background: Rectangle {
implicitWidth: 140 implicitWidth: 140
implicitHeight: 32 implicitHeight: 32
@ -100,7 +99,6 @@ T.ComboBox {
return hovered ? hoverColor :normalColor return hovered ? hoverColor :normalColor
} }
} }
popup: T.Popup { popup: T.Popup {
y: control.height y: control.height
width: control.width width: control.width

View File

@ -342,12 +342,9 @@ Rectangle {
} }
TableView { TableView {
id:table_view id:table_view
ListModel{
id:model_columns
}
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
anchors.fill: parent anchors.fill: parent
contentX: header_horizontal.contentX ScrollBar.horizontal:scroll_bar_h
ScrollBar.vertical:scroll_bar_v ScrollBar.vertical:scroll_bar_v
columnWidthProvider: function(column) { columnWidthProvider: function(column) {
var columnObject = d.columns_data[column] var columnObject = d.columns_data[column]
@ -732,9 +729,10 @@ Rectangle {
height: visible ? Math.max(1, contentHeight) : 0 height: visible ? Math.max(1, contentHeight) : 0
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
clip: true clip: true
contentX: table_view.contentX syncDirection: Qt.Horizontal
ScrollBar.horizontal:scroll_bar_h_2
columnWidthProvider: table_view.columnWidthProvider columnWidthProvider: table_view.columnWidthProvider
ScrollBar.horizontal:scroll_bar_h syncView: table_view.rows === 0 ? null : table_view
onContentXChanged:{ onContentXChanged:{
timer_horizontal_force_layout.restart() timer_horizontal_force_layout.restart()
} }
@ -761,15 +759,16 @@ Rectangle {
syncView: table_view syncView: table_view
clip: true clip: true
model: header_row_model model: header_row_model
delegate: com_row_header_delegate
onContentYChanged:{
timer_vertical_force_layout.restart()
}
Connections{ Connections{
target: table_model target: table_model
function onRowCountChanged(){ function onRowCountChanged(){
header_row_model.rows = Array.from({length: table_model.rows.length}, (_, i) => ({rowIndex:i+1})) header_row_model.rows = Array.from({length: table_model.rows.length}, (_, i) => ({rowIndex:i+1}))
} }
} }
onContentYChanged:{
timer_vertical_force_layout.restart()
}
Timer{ Timer{
id:timer_vertical_force_layout id:timer_vertical_force_layout
interval: 50 interval: 50
@ -777,19 +776,29 @@ Rectangle {
header_vertical.forceLayout() header_vertical.forceLayout()
} }
} }
delegate: com_row_header_delegate
} }
FluScrollBar { FluScrollBar {
id:scroll_bar_h id: scroll_bar_h
anchors{ anchors{
left: layout_mouse_table.left left: layout_mouse_table.left
right: parent.right right: parent.right
bottom: layout_mouse_table.bottom bottom: layout_mouse_table.bottom
} }
visible: table_view.rows !== 0
z:999 z:999
} }
FluScrollBar { FluScrollBar {
id:scroll_bar_v id: scroll_bar_h_2
anchors{
left: layout_mouse_table.left
right: parent.right
bottom: layout_mouse_table.bottom
}
visible: table_view.rows === 0
z:999
}
FluScrollBar {
id: scroll_bar_v
anchors{ anchors{
top: layout_mouse_table.top top: layout_mouse_table.top
bottom: layout_mouse_table.bottom bottom: layout_mouse_table.bottom