mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-05 17:55:25 +08:00
update
This commit is contained in:
@ -13,11 +13,14 @@ Rectangle{
|
||||
property string closeText : "关闭"
|
||||
property color textColor: FluTheme.dark ? "#FFFFFF" : "#000000"
|
||||
property color minimizeNormalColor: Qt.rgba(0,0,0,0)
|
||||
property color minimizeHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.1) : Qt.rgba(0,0,0,0.06)
|
||||
property color minimizeHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03)
|
||||
property color minimizePressColor: FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)
|
||||
property color maximizeNormalColor: Qt.rgba(0,0,0,0)
|
||||
property color maximizeHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.1) : Qt.rgba(0,0,0,0.06)
|
||||
property color maximizeHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03)
|
||||
property color maximizePressColor: FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)
|
||||
property color closeNormalColor: Qt.rgba(0,0,0,0)
|
||||
property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1)
|
||||
property color closePressColor: Qt.rgba(251/255,115/255,115/255,0.8)
|
||||
property bool showDark: false
|
||||
property bool showClose: true
|
||||
property bool showMinimize: true
|
||||
@ -114,7 +117,12 @@ Rectangle{
|
||||
radius: 0
|
||||
visible: !isMac && showMinimize
|
||||
iconColor: control.textColor
|
||||
color: hovered ? minimizeHoverColor : minimizeNormalColor
|
||||
color: {
|
||||
if(pressed){
|
||||
return minimizePressColor
|
||||
}
|
||||
return hovered ? minimizeHoverColor : minimizeNormalColor
|
||||
}
|
||||
onClicked: minClickListener()
|
||||
}
|
||||
FluIconButton{
|
||||
@ -122,7 +130,12 @@ Rectangle{
|
||||
Layout.preferredWidth: 40
|
||||
Layout.preferredHeight: 30
|
||||
iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
|
||||
color: hovered ? maximizeHoverColor : maximizeNormalColor
|
||||
color: {
|
||||
if(pressed){
|
||||
return maximizePressColor
|
||||
}
|
||||
return hovered ? maximizeHoverColor : maximizeNormalColor
|
||||
}
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: d.resizable && !isMac && showMaximize
|
||||
radius: 0
|
||||
@ -142,7 +155,12 @@ Rectangle{
|
||||
radius: 0
|
||||
iconSize: 10
|
||||
iconColor: hovered ? Qt.rgba(1,1,1,1) : control.textColor
|
||||
color:hovered ? closeHoverColor : closeNormalColor
|
||||
color:{
|
||||
if(pressed){
|
||||
return closePressColor
|
||||
}
|
||||
return hovered ? closeHoverColor : closeNormalColor
|
||||
}
|
||||
onClicked: closeClickListener()
|
||||
}
|
||||
}
|
||||
|
@ -8,9 +8,8 @@ Rectangle {
|
||||
id:control
|
||||
color:Qt.rgba(0,0,0,0)
|
||||
height: spacing*2+separator.height
|
||||
Rectangle{
|
||||
FluRectangle{
|
||||
id:separator
|
||||
clip: true
|
||||
color: FluTheme.dark ? Qt.rgba(80/255,80/255,80/255,1) : Qt.rgba(210/255,210/255,210/255,1)
|
||||
width:parent.width
|
||||
anchors.centerIn: parent
|
||||
|
@ -56,6 +56,8 @@ Item {
|
||||
return w
|
||||
}
|
||||
height: 30
|
||||
implicitWidth: width
|
||||
implicitHeight: height
|
||||
function toggle(){
|
||||
if(itemModel.isExpanded){
|
||||
tree_model.collapse(rowIndex)
|
||||
@ -63,33 +65,6 @@ Item {
|
||||
tree_model.expand(rowIndex)
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
radius: 4
|
||||
anchors.leftMargin: 6
|
||||
anchors.rightMargin: 6
|
||||
border.color: d.hitColor
|
||||
border.width: d.dragIndex === rowIndex ? 1 : 0
|
||||
color: {
|
||||
if(FluTheme.dark){
|
||||
if(isCurrent){
|
||||
return Qt.rgba(1,1,1,0.03)
|
||||
}
|
||||
if(item_mouse.containsMouse){
|
||||
return Qt.rgba(1,1,1,0.03)
|
||||
}
|
||||
return Qt.rgba(0,0,0,0)
|
||||
}else{
|
||||
if(isCurrent){
|
||||
return Qt.rgba(0,0,0,0.06)
|
||||
}
|
||||
if(item_mouse.containsMouse){
|
||||
return Qt.rgba(0,0,0,0.03)
|
||||
}
|
||||
return Qt.rgba(0,0,0,0)
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
width: 3
|
||||
height: 18
|
||||
@ -104,6 +79,7 @@ Item {
|
||||
}
|
||||
MouseArea{
|
||||
id:item_mouse
|
||||
property point clickPos: Qt.point(0,0)
|
||||
anchors.fill: parent
|
||||
drag.target:control.draggable ? loader_container : undefined
|
||||
hoverEnabled: true
|
||||
@ -116,15 +92,18 @@ Item {
|
||||
loader_container.sourceComponent = com_item_container
|
||||
}
|
||||
}
|
||||
onPressed: {
|
||||
loader_container.itemControl = itemControl
|
||||
loader_container.itemModel = itemModel
|
||||
var cellPosition = item_container.mapToItem(table_view, 0, 0)
|
||||
loader_container.width = item_container.width
|
||||
loader_container.height = item_container.height
|
||||
loader_container.x = table_view.contentX + cellPosition.x
|
||||
loader_container.y = table_view.contentY + cellPosition.y
|
||||
}
|
||||
onPressed: (mouse)=>{
|
||||
clickPos = Qt.point(mouse.x,mouse.y)
|
||||
console.debug(clickPos)
|
||||
loader_container.itemControl = itemControl
|
||||
loader_container.itemModel = itemModel
|
||||
var cellPosition = item_container.mapToItem(table_view, 0, 0)
|
||||
loader_container.width = item_container.width
|
||||
loader_container.height = item_container.height
|
||||
loader_container.x = table_view.contentX + cellPosition.x
|
||||
loader_container.y = table_view.contentY + cellPosition.y
|
||||
|
||||
}
|
||||
onClicked: {
|
||||
d.current = itemModel
|
||||
}
|
||||
@ -151,6 +130,7 @@ Item {
|
||||
var index = Math.round(y/30)
|
||||
if(index !== d.dragIndex){
|
||||
d.dropIndex = index
|
||||
tree_model.refreshNode(rowIndex)
|
||||
}else{
|
||||
d.dropIndex = -1
|
||||
}
|
||||
@ -174,10 +154,11 @@ Item {
|
||||
anchors{
|
||||
left: parent.left
|
||||
leftMargin: {
|
||||
var count = itemModel.depth+1
|
||||
if(itemModel.hasChildren()){
|
||||
return 30*(itemModel.depth+1) - 8
|
||||
return 30*count - 8
|
||||
}
|
||||
return 30*(itemModel.depth+1) + 18
|
||||
return 30*count + 18
|
||||
}
|
||||
right: parent.right
|
||||
rightMargin: 10
|
||||
@ -202,10 +183,10 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
FluRectangle{
|
||||
width: 1
|
||||
color: control.lineColor
|
||||
visible: itemModel.depth !== 0 && control.showLine && !itemModel.hasChildren()
|
||||
visible: control.showLine && isItemLoader && itemModel.depth !== 0 && !itemModel.hasChildren()
|
||||
height: itemModel.hideLineFooter() ? parent.height/2 : parent.height
|
||||
anchors{
|
||||
top: parent.top
|
||||
@ -213,10 +194,10 @@ Item {
|
||||
rightMargin: -9
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
FluRectangle{
|
||||
height: 1
|
||||
color: control.lineColor
|
||||
visible: itemModel.depth !== 0 && control.showLine && !itemModel.hasChildren()
|
||||
visible: control.showLine && isItemLoader && itemModel.depth !== 0 && !itemModel.hasChildren()
|
||||
width: 18
|
||||
anchors{
|
||||
right: layout_row.left
|
||||
@ -226,11 +207,11 @@ Item {
|
||||
}
|
||||
Repeater{
|
||||
model: Math.max(itemModel.depth-1,0)
|
||||
delegate: Rectangle{
|
||||
delegate: FluRectangle{
|
||||
required property int index
|
||||
width: 1
|
||||
color: control.lineColor
|
||||
visible: itemModel.depth !== 0 && control.showLine
|
||||
visible: control.showLine && isItemLoader && itemModel.depth !== 0 && itemModel.hasNextNodeByIndex(index)
|
||||
anchors{
|
||||
top:parent.top
|
||||
bottom: parent.bottom
|
||||
@ -239,6 +220,33 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
radius: 4
|
||||
anchors.leftMargin: 6
|
||||
anchors.rightMargin: 6
|
||||
border.color: d.hitColor
|
||||
border.width: d.dragIndex === rowIndex ? 1 : 0
|
||||
color: {
|
||||
if(FluTheme.dark){
|
||||
if(isCurrent){
|
||||
return Qt.rgba(1,1,1,0.03)
|
||||
}
|
||||
if(item_mouse.containsMouse){
|
||||
return Qt.rgba(1,1,1,0.03)
|
||||
}
|
||||
return Qt.rgba(0,0,0,0)
|
||||
}else{
|
||||
if(isCurrent){
|
||||
return Qt.rgba(0,0,0,0.06)
|
||||
}
|
||||
if(item_mouse.containsMouse){
|
||||
return Qt.rgba(0,0,0,0.03)
|
||||
}
|
||||
return Qt.rgba(0,0,0,0)
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout{
|
||||
id:layout_row
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@ -310,14 +318,9 @@ Item {
|
||||
property var itemControl: item_control
|
||||
property var itemModel: modelData
|
||||
property int rowIndex: row
|
||||
property bool isItemLoader: true
|
||||
id:item_loader_container
|
||||
width: item.width
|
||||
height: item.height
|
||||
sourceComponent: {
|
||||
if(modelData)
|
||||
return com_item_container
|
||||
return undefined
|
||||
}
|
||||
sourceComponent: com_item_container
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -326,6 +329,7 @@ Item {
|
||||
id:loader_container
|
||||
property var itemControl
|
||||
property var itemModel
|
||||
property bool isItemLoader: false
|
||||
}
|
||||
}
|
||||
function count(){
|
||||
|
Reference in New Issue
Block a user