Compare commits

...

6 Commits

Author SHA1 Message Date
7276eb5f2f update 2023-07-04 15:15:58 +08:00
b6c689e0ec update 2023-07-04 15:09:48 +08:00
a48bc51edc update 2023-07-03 21:25:26 +08:00
b2d0975ed7 update 2023-07-03 18:44:43 +08:00
7dea573069 update 2023-07-03 18:08:25 +08:00
0d4dd483da update 2023-07-03 11:50:26 +08:00
28 changed files with 405 additions and 223 deletions

View File

@ -19,7 +19,7 @@ endif()
file(TO_CMAKE_PATH "/" PATH_SEPARATOR) file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
#设置版本号 #设置版本号
add_definitions(-DVERSION=1,3,7,2) add_definitions(-DVERSION=1,3,7,3)
find_package(Qt6 REQUIRED COMPONENTS Quick) find_package(Qt6 REQUIRED COMPONENTS Quick)

View File

@ -37,11 +37,6 @@ FluExpander{
rightMargin: 5 rightMargin: 5
topMargin: 5 topMargin: 5
} }
onActiveFocusChanged: {
if(activeFocus){
control.expand = true
}
}
onClicked:{ onClicked:{
FluTools.clipText(content.text) FluTools.clipText(content.text)
showSuccess("复制成功") showSuccess("复制成功")

View File

@ -76,7 +76,6 @@ FluScrollablePage{
Image{ Image{
source: "qrc:/example/res/image/banner_1.jpg" source: "qrc:/example/res/image/banner_1.jpg"
asynchronous: true asynchronous: true
sourceSize: Qt.size(400,300)
fillMode:Image.PreserveAspectCrop fillMode:Image.PreserveAspectCrop
} }
Image{ Image{

View File

@ -8,6 +8,7 @@ import FluentUI
FluScrollablePage{ FluScrollablePage{
pageMode: FluNavigationView.SingleTask pageMode: FluNavigationView.SingleTask
animDisabled: true
ListModel{ ListModel{
id:model_header id:model_header

View File

@ -11,7 +11,7 @@ FluScrollablePage{
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
height: 300 height: 260
paddings: 10 paddings: 10
Layout.topMargin: 20 Layout.topMargin: 20
Column{ Column{

View File

@ -12,32 +12,71 @@ FluScrollablePage{
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 260 height: 110
paddings: 10 paddings: 10
ColumnLayout{ ColumnLayout{
spacing: 20 spacing: 10
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
} }
FluText{
text: "indeterminate = true"
}
FluProgressBar{ FluProgressBar{
} }
FluProgressRing{ FluProgressRing{
} }
FluProgressBar{ }
id:progress_bar }
indeterminate: false CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -1
code:'FluProgressBar{
} }
FluProgressRing{ FluProgressRing{
id:progress_ring
}
'
}
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
height: 230
paddings: 10
ColumnLayout{
spacing: 10
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text: "indeterminate = false"
}
FluProgressBar{
indeterminate: false indeterminate: false
progress: slider.value/100
}
FluProgressRing{
indeterminate: false
progress: slider.value/100
}
FluProgressBar{
indeterminate: false
progressVisible: true
progress: slider.value/100
}
FluProgressRing{
indeterminate: false
progressVisible: true
progress: slider.value/100
} }
FluSlider{ FluSlider{
onValueChanged:{ id:slider
var progress = value/100
progress_bar.progress = progress
progress_ring.progress = progress
}
Component.onCompleted: { Component.onCompleted: {
value = 50 value = 50
} }
@ -48,22 +87,14 @@ FluScrollablePage{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -1
code:'FluProgressBar{ code:'FluProgressBar{
}
FluProgressRing{
}
FluProgressBar{
indeterminate: false indeterminate: false
} }
FluProgressRing{ FluProgressRing{
indeterminate: false indeterminate: false
}' progressVisible: true
}
'
} }
} }

View File

@ -12,7 +12,7 @@ FluScrollablePage{
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 480 height: 460
paddings: 10 paddings: 10
Column{ Column{

View File

@ -64,8 +64,8 @@ FluContentPage{
address: getRandomAddresses(), address: getRandomAddresses(),
nickname: getRandomNickname(), nickname: getRandomNickname(),
longstring:"你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好", longstring:"你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好",
height:46, height:42,
minimumHeight:46, minimumHeight:42,
maximumHeight:300, maximumHeight:300,
action:com_action action:com_action
}) })

View File

@ -16,7 +16,7 @@ CustomWindow {
height: 640 height: 640
closeDestory:false closeDestory:false
minimumWidth: 520 minimumWidth: 520
minimumHeight: 460 minimumHeight: 200
appBarVisible: false appBarVisible: false
launchMode: FluWindow.SingleTask launchMode: FluWindow.SingleTask
@ -95,7 +95,7 @@ CustomWindow {
when: flipable.flipped when: flipable.flipped
} }
transitions: Transition { transitions: Transition {
NumberAnimation { target: flipable; property: "flipAngle"; duration: 1000 ; easing.type: Easing.OutQuad} NumberAnimation { target: flipable; property: "flipAngle"; duration: 1000 ; easing.type: Easing.OutCubic}
} }
back: Item{ back: Item{
anchors.fill: flipable anchors.fill: flipable

View File

@ -12,7 +12,7 @@ endif()
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI) set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
#设置版本号 #设置版本号
add_definitions(-DVERSION=1,3,7,2) add_definitions(-DVERSION=1,3,7,3)
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml) find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)

View File

@ -39,8 +39,8 @@ ComboBox {
} }
contentItem: T.TextField { contentItem: T.TextField {
property bool disabled: !control.editable property bool disabled: !control.editable
leftPadding: !control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1 leftPadding: !control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
rightPadding: control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1 rightPadding: control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
topPadding: 6 - control.padding topPadding: 6 - control.padding
bottomPadding: 6 - control.padding bottomPadding: 6 - control.padding
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering

View File

@ -9,10 +9,8 @@ Item {
property int contentHeight : 300 property int contentHeight : 300
default property alias content: container.data default property alias content: container.data
id:control id:control
height: layout_header.height + container.height implicitHeight: Math.max((layout_header.height + container.height),layout_header.height)
width: 400 implicitWidth: 400
implicitWidth: width
implicitHeight: height
Rectangle{ Rectangle{
id:layout_header id:layout_header
width: parent.width width: parent.width
@ -58,29 +56,66 @@ Item {
Behavior on rotation { Behavior on rotation {
NumberAnimation{ NumberAnimation{
duration: 167 duration: 167
easing.type: Easing.OutCubic
} }
} }
} }
} }
} }
Rectangle{ Item{
id:container
width: parent.width
clip: true
anchors{ anchors{
top: layout_header.bottom top: layout_header.bottom
topMargin: -1 topMargin: -1
left: layout_header.left left: layout_header.left
} }
width: parent.width
clip: true
visible: contentHeight+container.y !== 0
height: contentHeight+container.y
Rectangle{
id:container
width: parent.width
height: parent.height
radius: 4 radius: 4
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
height: expand ? contentHeight : 0 y: -contentHeight
Behavior on height { states: [
State{
name:"expand"
when: control.expand
PropertyChanges {
target: container
y:0
}
},
State{
name:"collapsed"
when: !control.expand
PropertyChanges {
target: container
y:-contentHeight
}
}
]
transitions: [
Transition {
to:"expand"
NumberAnimation { NumberAnimation {
properties: "y"
duration: 167 duration: 167
easing.type: Easing.InCubic easing.type: Easing.OutCubic
} }
},
Transition {
to:"collapsed"
NumberAnimation {
properties: "y"
duration: 167
easing.type: Easing.OutCubic
}
}
]
} }
} }
} }

View File

@ -23,7 +23,7 @@ TextArea{
font:FluTextStyle.Body font:FluTextStyle.Body
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
padding: 8 padding: 8
leftPadding: 8 leftPadding: padding+2
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectedTextColor: color selectedTextColor: color
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6) selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)

View File

@ -118,11 +118,6 @@ Item {
} }
return 1 return 1
} }
Behavior on height {
NumberAnimation{
duration: 83
}
}
} }
} }
Component{ Component{
@ -242,7 +237,8 @@ Item {
} }
Behavior on rotation { Behavior on rotation {
NumberAnimation{ NumberAnimation{
duration: 83 duration: 167
easing.type: Easing.OutCubic
} }
} }
} }
@ -564,7 +560,7 @@ Item {
Behavior on Layout.preferredWidth { Behavior on Layout.preferredWidth {
NumberAnimation{ NumberAnimation{
duration: 167 duration: 167
easing.type: Easing.InCubic easing.type: Easing.OutCubic
} }
} }
} }
@ -630,7 +626,7 @@ Item {
Behavior on anchors.leftMargin { Behavior on anchors.leftMargin {
NumberAnimation{ NumberAnimation{
duration: 167 duration: 167
easing.type: Easing.InCubic easing.type: Easing.OutCubic
} }
} }
StackView{ StackView{
@ -685,13 +681,13 @@ Item {
Behavior on width { Behavior on width {
NumberAnimation{ NumberAnimation{
duration: 167 duration: 167
easing.type: Easing.InCubic easing.type: Easing.OutCubic
} }
} }
Behavior on x { Behavior on x {
NumberAnimation{ NumberAnimation{
duration: 167 duration: 167
easing.type: Easing.InCubic easing.type: Easing.OutCubic
} }
} }
visible: { visible: {
@ -751,11 +747,25 @@ Item {
} }
} }
} }
Flickable{
id:layout_flickable
anchors{
top: layout_header.bottom
topMargin: 6
left: parent.left
right: parent.right
bottom: layout_footer.top
}
boundsBehavior: ListView.StopAtBounds
clip: true
contentHeight: nav_list.contentHeight
ScrollBar.vertical: FluScrollBar {}
ListView{ ListView{
id:nav_list id:nav_list
clip: true clip: true
ScrollBar.vertical: FluScrollBar {} anchors.fill: parent
model:d.handleItems() model:d.handleItems()
boundsBehavior: ListView.StopAtBounds
highlightMoveDuration: 167 highlightMoveDuration: 167
highlight: Item{ highlight: Item{
clip: true clip: true
@ -772,13 +782,7 @@ Item {
} }
} }
currentIndex: -1 currentIndex: -1
anchors{
top: layout_header.bottom
topMargin: 6
left: parent.left
right: parent.right
bottom: layout_footer.top
}
delegate: Loader{ delegate: Loader{
property var model: modelData property var model: modelData
property var idx: index property var idx: index
@ -802,6 +806,8 @@ Item {
} }
} }
} }
}
ListView{ ListView{
id:layout_footer id:layout_footer
clip: true clip: true
@ -809,6 +815,7 @@ Item {
height: childrenRect.height height: childrenRect.height
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
interactive: false interactive: false
boundsBehavior: ListView.StopAtBounds
currentIndex: -1 currentIndex: -1
model: { model: {
if(footerItems){ if(footerItems){

View File

@ -6,13 +6,25 @@ import FluentUI
Item { Item {
property int pageMode: FluNavigationView.SingleTop property int pageMode: FluNavigationView.SingleTop
property bool animDisabled: false
property string url : "" property string url : ""
id: control id: control
opacity: visible opacity: visible
visible: false visible: false
Behavior on opacity{ Behavior on opacity{
enabled: !animDisabled
NumberAnimation{ NumberAnimation{
duration: 83 duration: 167
}
}
transform: Translate {
y: control.visible ? 0 : 80
Behavior on y{
enabled: !animDisabled
NumberAnimation{
duration: 167
easing.type: Easing.OutCubic
}
} }
} }
Component.onCompleted: { Component.onCompleted: {

View File

@ -23,7 +23,7 @@ TextField{
} }
font:FluTextStyle.Body font:FluTextStyle.Body
padding: 8 padding: 8
leftPadding: 8 leftPadding: padding+2
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6) selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)

View File

@ -40,7 +40,7 @@ Item {
Behavior on width { Behavior on width {
NumberAnimation{ NumberAnimation{
duration: 167 duration: 167
easing.type: Easing.InCubic easing.type: Easing.OutCubic
} }
} }
} }

View File

@ -21,6 +21,7 @@ Popup {
from:1.2 from:1.2
to:1 to:1
duration: 83 duration: 83
easing.type: Easing.OutCubic
} }
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"
@ -35,6 +36,7 @@ Popup {
from:1 from:1
to:1.2 to:1.2
duration: 83 duration: 83
easing.type: Easing.OutCubic
} }
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"

View File

@ -2,14 +2,19 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import FluentUI import FluentUI
FluRectangle { Item{
property real progress: 0.5 property real progress: 0.5
property bool indeterminate: true property bool indeterminate: true
property bool progressVisible: false
id: control id: control
width: 150 width: 150
height: 5 height: 5
FluRectangle {
shadow: false
radius: [3,3,3,3] radius: [3,3,3,3]
clip: true anchors.fill: parent
color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1) color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1)
Component.onCompleted: { Component.onCompleted: {
if(indeterminate){ if(indeterminate){
@ -43,3 +48,21 @@ FluRectangle {
} }
} }
} }
FluText{
text:(control.progress * 100).toFixed(0) + "%"
font.pixelSize: 10
visible: {
if(control.indeterminate){
return false
}
return control.progressVisible
}
anchors{
left: parent.left
leftMargin: control.width+5
verticalCenter: parent.verticalCenter
}
}
}

View File

@ -3,11 +3,11 @@ import QtQuick.Controls
import FluentUI import FluentUI
Rectangle { Rectangle {
property real linWidth : width/8 property real linWidth : 5
property real progress: 0.25 property real progress: 0.25
property bool indeterminate: true property bool indeterminate: true
readonly property real radius2 : radius - linWidth/2
property color primaryColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark property color primaryColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
property bool progressVisible: false
id: control id: control
width: 44 width: 44
height: 44 height: 44
@ -24,6 +24,10 @@ Rectangle {
control.rotation = 360 control.rotation = 360
} }
} }
QtObject{
id:d
property real _radius: control.radius-control.linWidth/2
}
Connections{ Connections{
target: FluTheme target: FluTheme
function onDarkChanged(){ function onDarkChanged(){
@ -35,8 +39,6 @@ Rectangle {
enabled: false enabled: false
NumberAnimation{ NumberAnimation{
duration: 999 duration: 999
easing.type: Easing.BezierSpline
easing.bezierCurve: [0.55,0.55,0,1]
onRunningChanged: { onRunningChanged: {
if(!running){ if(!running){
behavior.enabled = false behavior.enabled = false
@ -53,18 +55,29 @@ Rectangle {
antialiasing: true antialiasing: true
renderTarget: Canvas.Image renderTarget: Canvas.Image
onPaint: { onPaint: {
var ctx = canvas.getContext("2d"); var ctx = canvas.getContext("2d")
ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.setTransform(1, 0, 0, 1, 0, 0)
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height)
ctx.save(); ctx.save()
ctx.lineWidth = linWidth; ctx.lineWidth = linWidth
ctx.strokeStyle = primaryColor; ctx.strokeStyle = primaryColor
ctx.fillStyle = primaryColor; ctx.fillStyle = primaryColor
ctx.beginPath(); ctx.beginPath()
ctx.arc(width/2, height/2, radius2 ,-0.5 * Math.PI,-0.5 * Math.PI + progress * 2 * Math.PI); ctx.arc(width/2, height/2, d._radius ,-0.5 * Math.PI,-0.5 * Math.PI + progress * 2 * Math.PI)
ctx.stroke(); ctx.stroke()
ctx.closePath(); ctx.closePath()
ctx.restore(); ctx.restore()
} }
} }
FluText{
text:(control.progress * 100).toFixed(0) + "%"
font.pixelSize: 10
visible: {
if(control.indeterminate){
return false
}
return control.progressVisible
}
anchors.centerIn: parent
}
} }

View File

@ -64,8 +64,7 @@ Button {
Behavior on border.width { Behavior on border.width {
NumberAnimation{ NumberAnimation{
duration: 167 duration: 167
easing.type: Easing.BezierSpline easing.type: Easing.OutCubic
easing.bezierCurve: [ 0, 0, 0, 1 ]
} }
} }
border.color: { border.color: {

View File

@ -41,7 +41,7 @@ T.ScrollBar {
} }
states: [ states: [
State{ State{
name:"hide" name:"show"
when: contentItem.collapsed when: contentItem.collapsed
PropertyChanges { PropertyChanges {
target: rect_bar target: rect_bar
@ -50,8 +50,8 @@ T.ScrollBar {
} }
} }
,State{ ,State{
name:"show" name:"hide"
when: !contentItem.expand when: !contentItem.collapsed
PropertyChanges { PropertyChanges {
target: rect_bar target: rect_bar
width: vertical ? 2 : parent.width width: vertical ? 2 : parent.width
@ -61,26 +61,27 @@ T.ScrollBar {
] ]
transitions:[ transitions:[
Transition { Transition {
from: "hide" to: "hide"
SequentialAnimation { SequentialAnimation {
PauseAnimation { duration: 450 } PauseAnimation { duration: 450 }
NumberAnimation { NumberAnimation {
target: rect_bar target: rect_bar
properties: vertical ? "width" : "height" properties: vertical ? "width" : "height"
duration: 167 duration: 167
easing.type: Easing.InCubic easing.type: Easing.OutCubic
to:2
} }
} }
} }
,Transition { ,Transition {
from: "show" to: "show"
SequentialAnimation{
PauseAnimation { duration: 100 }
NumberAnimation { NumberAnimation {
target: rect_bar target: rect_bar
properties: vertical ? "width" : "height" properties: vertical ? "width" : "height"
duration: 167 duration: 167
easing.type: Easing.InCubic easing.type: Easing.OutCubic
to:6 }
} }
} }
] ]

View File

@ -44,6 +44,7 @@ FluPage {
anchors.right: flickview.right anchors.right: flickview.right
anchors.rightMargin: 2 anchors.rightMargin: 2
} }
boundsBehavior: Flickable.StopAtBounds
anchors{ anchors{
top: text_title.bottom top: text_title.bottom
bottom: parent.bottom bottom: parent.bottom

View File

@ -38,6 +38,7 @@ T.Slider {
Behavior on scale { Behavior on scale {
NumberAnimation{ NumberAnimation{
duration: 167 duration: 167
easing.type: Easing.OutCubic
} }
} }
} }

View File

@ -49,6 +49,9 @@ Rectangle {
if(obj){ if(obj){
return obj return obj
} }
if(columnSource[column].editMultiline === true){
return com_edit_multiline
}
return com_edit return com_edit
} }
} }
@ -63,6 +66,23 @@ Rectangle {
} }
Component{ Component{
id:com_edit id:com_edit
FluTextBox{
text: display
readOnly: true === columnSource[column].readOnly
Component.onCompleted: {
forceActiveFocus()
selectAll()
}
onCommit: {
if(!readOnly){
display = text
}
tableView.closeEditor()
}
}
}
Component{
id:com_edit_multiline
Item{ Item{
anchors.fill: parent anchors.fill: parent
ScrollView{ ScrollView{
@ -202,7 +222,7 @@ Rectangle {
implicitWidth: columnSource[column].width implicitWidth: columnSource[column].width
Rectangle{ Rectangle{
anchors.fill: parent anchors.fill: parent
visible: item_loader.sourceComponent === null visible: !item_loader.sourceComponent
color: selected ? control.selectionColor : "#00000000" color: selected ? control.selectionColor : "#00000000"
} }
MouseArea{ MouseArea{
@ -212,6 +232,9 @@ Rectangle {
closeEditor() closeEditor()
table_view.interactive = false table_view.interactive = false
} }
onCanceled: {
table_view.interactive = true
}
onReleased: { onReleased: {
table_view.interactive = true table_view.interactive = true
} }
@ -270,12 +293,7 @@ Rectangle {
} }
SelectionRectangle { SelectionRectangle {
id:selection_rect id:selection_rect
target: { target: table_view
if(item_loader.sourceComponent){
return null
}
return table_view
}
bottomRightHandle:com_handle bottomRightHandle:com_handle
topLeftHandle: com_handle topLeftHandle: com_handle
onDraggingChanged: { onDraggingChanged: {
@ -298,26 +316,24 @@ Rectangle {
syncView: table_view syncView: table_view
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
clip: true clip: true
delegate: FluControl { delegate: Rectangle {
id:column_item_control id:column_item_control
readonly property real cellPadding: 8 readonly property real cellPadding: 8
property bool canceled: false
readonly property var obj : columnSource[column] readonly property var obj : columnSource[column]
implicitWidth: column_text.implicitWidth + (cellPadding * 2) implicitWidth: column_text.implicitWidth + (cellPadding * 2)
implicitHeight: Math.max(header_horizontal.height, column_text.implicitHeight + (cellPadding * 2)) implicitHeight: Math.max(header_horizontal.height, column_text.implicitHeight + (cellPadding * 2))
Rectangle{
anchors.fill: parent
color:{ color:{
d.selectionFlag d.selectionFlag
if(column_item_control.pressed){ if(column_item_control_mouse.pressed){
return control.pressedButtonColor return control.pressedButtonColor
} }
if(selection_model.isColumnSelected(column)){ if(selection_model.isColumnSelected(column)){
return control.hoverButtonColor return control.hoverButtonColor
} }
return column_item_control.hovered ? control.hoverButtonColor : FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) return column_item_control_mouse.containsMouse&&!canceled ? control.hoverButtonColor : FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
} }
border.color: FluTheme.dark ? "#252525" : "#e4e4e4" border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
}
FluText { FluText {
id: column_text id: column_text
text: model.display text: model.display
@ -330,34 +346,59 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
onClicked: { MouseArea{
id:column_item_control_mouse
anchors.fill: parent
anchors.rightMargin: 6
hoverEnabled: true
onCanceled: {
column_item_control.canceled = true
}
onContainsMouseChanged: {
if(!containsMouse){
column_item_control.canceled = false
}
}
onClicked:
(event)=>{
closeEditor() closeEditor()
if(!(event.modifiers & Qt.ControlModifier)){
selection_model.clear() selection_model.clear()
}
for(var i=0;i<=table_view.rows;i++){ for(var i=0;i<=table_view.rows;i++){
selection_model.select(table_model.index(i,column),ItemSelectionModel.Select) selection_model.select(table_model.index(i,column),ItemSelectionModel.Select)
} }
d.selectionFlag = !d.selectionFlag d.selectionFlag = !d.selectionFlag
} }
}
MouseArea{ MouseArea{
property point clickPos: "0,0" property point clickPos: "0,0"
height: parent.height height: parent.height
width: 6 width: 6
anchors.right: parent.right anchors.right: parent.right
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
hoverEnabled: true
visible: !(obj.width === obj.minimumWidth && obj.width === obj.maximumWidth) visible: !(obj.width === obj.minimumWidth && obj.width === obj.maximumWidth)
cursorShape: Qt.SplitHCursor cursorShape: Qt.SplitHCursor
preventStealing: true
propagateComposedEvents: true
onPressed : onPressed :
(mouse)=>{ (mouse)=>{
header_horizontal.interactive = false
FluTools.setOverrideCursor(Qt.SplitHCursor) FluTools.setOverrideCursor(Qt.SplitHCursor)
clickPos = Qt.point(mouse.x, mouse.y) clickPos = Qt.point(mouse.x, mouse.y)
} }
onReleased:{ onReleased:{
header_horizontal.interactive = true
FluTools.restoreOverrideCursor()
}
onCanceled: {
header_horizontal.interactive = true
FluTools.restoreOverrideCursor() FluTools.restoreOverrideCursor()
} }
onPositionChanged: onPositionChanged:
(mouse)=>{ (mouse)=>{
if(!pressed){
return
}
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y) var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
var minimumWidth = obj.minimumWidth var minimumWidth = obj.minimumWidth
var maximumWidth = obj.maximumWidth var maximumWidth = obj.maximumWidth
@ -391,25 +432,23 @@ Rectangle {
return [] return []
} }
} }
delegate: FluControl{ delegate: Rectangle{
id:item_control id:item_control
readonly property real cellPadding: 8 readonly property real cellPadding: 8
property bool canceled: false
implicitWidth: Math.max(header_vertical.width, row_text.implicitWidth + (cellPadding * 2)) implicitWidth: Math.max(header_vertical.width, row_text.implicitWidth + (cellPadding * 2))
implicitHeight: row_text.implicitHeight + (cellPadding * 2) implicitHeight: row_text.implicitHeight + (cellPadding * 2)
Rectangle{
anchors.fill: parent
color: { color: {
d.selectionFlag d.selectionFlag
if(item_control.pressed){ if(item_control_mouse.pressed){
return control.pressedButtonColor return control.pressedButtonColor
} }
if(selection_model.isRowSelected(row)){ if(selection_model.isRowSelected(row)){
return control.hoverButtonColor return control.hoverButtonColor
} }
return item_control.hovered ? control.hoverButtonColor : FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) return item_control_mouse.containsMouse&&!canceled ? control.hoverButtonColor : FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
} }
border.color: FluTheme.dark ? "#252525" : "#e4e4e4" border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
}
FluText{ FluText{
id:row_text id:row_text
anchors.centerIn: parent anchors.centerIn: parent
@ -419,14 +458,31 @@ Rectangle {
return selection_model.rowIntersectsSelection(row) return selection_model.rowIntersectsSelection(row)
} }
} }
onClicked: { MouseArea{
id:item_control_mouse
anchors.fill: parent
anchors.bottomMargin: 6
hoverEnabled: true
onCanceled: {
item_control.canceled = true
}
onContainsMouseChanged: {
if(!containsMouse){
item_control.canceled = false
}
}
onClicked:
(event)=>{
closeEditor() closeEditor()
if(!(event.modifiers & Qt.ControlModifier)){
selection_model.clear() selection_model.clear()
}
for(var i=0;i<=columnSource.length;i++){ for(var i=0;i<=columnSource.length;i++){
selection_model.select(table_model.index(row,i),ItemSelectionModel.Select) selection_model.select(table_model.index(row,i),ItemSelectionModel.Select)
} }
d.selectionFlag = !d.selectionFlag d.selectionFlag = !d.selectionFlag
} }
}
MouseArea{ MouseArea{
property point clickPos: "0,0" property point clickPos: "0,0"
height: 6 height: 6
@ -434,28 +490,35 @@ Rectangle {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
cursorShape: Qt.SplitVCursor cursorShape: Qt.SplitVCursor
preventStealing: true
visible: { visible: {
var obj = table_model.getRow(row) var obj = table_model.getRow(row)
return !(obj.height === obj.minimumHeight && obj.width === obj.maximumHeight) return !(obj.height === obj.minimumHeight && obj.width === obj.maximumHeight)
} }
propagateComposedEvents: true
onPressed : onPressed :
(mouse)=>{ (mouse)=>{
header_vertical.interactive = false
FluTools.setOverrideCursor(Qt.SplitVCursor) FluTools.setOverrideCursor(Qt.SplitVCursor)
clickPos = Qt.point(mouse.x, mouse.y) clickPos = Qt.point(mouse.x, mouse.y)
} }
onReleased:{ onReleased:{
header_vertical.interactive = true
FluTools.restoreOverrideCursor()
}
onCanceled: {
header_vertical.interactive = true
FluTools.restoreOverrideCursor() FluTools.restoreOverrideCursor()
} }
onPositionChanged: onPositionChanged:
(mouse)=>{ (mouse)=>{
if(!pressed){
return
}
var obj = table_model.getRow(row) var obj = table_model.getRow(row)
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y) var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
var minimumHeight = obj.minimumHeight var minimumHeight = obj.minimumHeight
var maximumHeight = obj.maximumHeight var maximumHeight = obj.maximumHeight
if(!minimumHeight){ if(!minimumHeight){
minimumHeight = 46 minimumHeight = 42
} }
if(!maximumHeight){ if(!maximumHeight){
maximumHeight = 65535 maximumHeight = 65535

View File

@ -16,7 +16,7 @@ TextField{
id:control id:control
width: 300 width: 300
padding: 8 padding: 8
leftPadding: 8 leftPadding: padding+2
enabled: !disabled enabled: !disabled
color: { color: {
if(!enabled){ if(!enabled){

View File

@ -49,8 +49,7 @@ Rectangle{
Behavior on height{ Behavior on height{
NumberAnimation{ NumberAnimation{
duration: 83 duration: 83
easing.type: Easing.BezierSpline easing.type: Easing.OutCubic
easing.bezierCurve: [ 1, 0, 0, 0 ]
} }
} }
} }

View File

@ -92,25 +92,25 @@ Button {
Behavior on anchors.leftMargin { Behavior on anchors.leftMargin {
NumberAnimation { NumberAnimation {
duration: 167 duration: 167
easing.type: Easing.BezierSpline easing.type: Easing.OutCubic
easing.bezierCurve: [ 1, 0, 0, 0 ]
} }
} }
Behavior on anchors.rightMargin { Behavior on anchors.rightMargin {
NumberAnimation { NumberAnimation {
duration: 167 duration: 167
easing.type: Easing.BezierSpline easing.type: Easing.OutCubic
easing.bezierCurve: [ 0, 0, 0, 1 ]
} }
} }
Behavior on width { Behavior on width {
NumberAnimation { NumberAnimation {
duration: 167 duration: 167
easing.type: Easing.OutCubic
} }
} }
Behavior on scale { Behavior on scale {
NumberAnimation { NumberAnimation {
duration: 167 duration: 167
easing.type: Easing.OutCubic
} }
} }
} }