mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-06 10:45:26 +08:00
update
This commit is contained in:
@ -33,6 +33,7 @@ Rectangle{
|
||||
property int iconSize: 20
|
||||
property bool isMac: FluTools.isMacos()
|
||||
property color borerlessColor : FluTheme.primaryColor
|
||||
property bool systemMoveEnable: true
|
||||
property var maxClickListener : function(){
|
||||
if(FluTools.isMacos()){
|
||||
if (d.win.visibility === Window.FullScreen)
|
||||
@ -70,6 +71,11 @@ Rectangle{
|
||||
d.win.showSystemMenu()
|
||||
}
|
||||
}
|
||||
property alias buttonStayTop: btn_stay_top
|
||||
property alias buttonMinimize: btn_minimize
|
||||
property alias buttonMaximize: btn_maximize
|
||||
property alias buttonClose: btn_close
|
||||
property alias buttonDark: btn_dark
|
||||
id:control
|
||||
color: Qt.rgba(0,0,0,0)
|
||||
height: visible ? 30 : 0
|
||||
@ -77,6 +83,7 @@ Rectangle{
|
||||
z: 65535
|
||||
Item{
|
||||
id:d
|
||||
property var hitTestList: []
|
||||
property bool hoverMaxBtn: false
|
||||
property var win: Window.window
|
||||
property bool stayTop: {
|
||||
@ -89,21 +96,24 @@ Rectangle{
|
||||
property bool resizable: win && !(win.height === win.maximumHeight && win.height === win.minimumHeight && win.width === win.maximumWidth && win.width === win.minimumWidth)
|
||||
}
|
||||
MouseArea{
|
||||
id:mouse_app_bar
|
||||
anchors.fill: parent
|
||||
onPositionChanged:
|
||||
(mouse)=>{
|
||||
d.win.startSystemMove()
|
||||
if(systemMoveEnable){
|
||||
d.win.startSystemMove()
|
||||
}
|
||||
}
|
||||
onDoubleClicked:
|
||||
(mouse)=>{
|
||||
if(d.resizable && Qt.LeftButton){
|
||||
if(systemMoveEnable && d.resizable && Qt.LeftButton){
|
||||
btn_maximize.clicked()
|
||||
}
|
||||
}
|
||||
acceptedButtons: Qt.LeftButton|Qt.RightButton
|
||||
onClicked:
|
||||
(mouse)=>{
|
||||
if (mouse.button === Qt.RightButton){
|
||||
if (systemMoveEnable && mouse.button === Qt.RightButton){
|
||||
control.systemMenuListener()
|
||||
}
|
||||
}
|
||||
@ -174,9 +184,13 @@ Rectangle{
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
id:layout_row
|
||||
anchors.right: parent.right
|
||||
height: control.height
|
||||
spacing: 0
|
||||
Component.onCompleted: {
|
||||
setHitTestVisible(layout_row)
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:btn_dark
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
@ -267,23 +281,8 @@ Rectangle{
|
||||
onClicked: closeClickListener()
|
||||
}
|
||||
}
|
||||
function stayTopButton(){
|
||||
return btn_stay_top
|
||||
}
|
||||
function minimizeButton(){
|
||||
return btn_minimize
|
||||
}
|
||||
function maximizeButton(){
|
||||
return btn_maximize
|
||||
}
|
||||
function closeButton(){
|
||||
return btn_close
|
||||
}
|
||||
function darkButton(){
|
||||
return btn_dark
|
||||
}
|
||||
function maximizeButtonHover(){
|
||||
var hover = false;
|
||||
function _maximizeButtonHover(){
|
||||
var hover = false
|
||||
var pos = btn_maximize.mapToGlobal(0,0)
|
||||
if(btn_maximize.visible){
|
||||
var rect = Qt.rect(pos.x,pos.y,btn_maximize.width,btn_maximize.height)
|
||||
@ -295,4 +294,21 @@ Rectangle{
|
||||
d.hoverMaxBtn = hover
|
||||
return hover;
|
||||
}
|
||||
function _appBarHover(){
|
||||
for(var i =0 ;i< d.hitTestList.length; i++){
|
||||
var item = d.hitTestList[i]
|
||||
var pos = item.mapToGlobal(0,0)
|
||||
if(item.visible){
|
||||
var rect = Qt.rect(pos.x,pos.y,item.width,item.height)
|
||||
pos = FluTools.cursorPos()
|
||||
if(pos.x>rect.x && pos.x<(rect.x+rect.width) && pos.y>rect.y && pos.y<(rect.y+rect.height)){
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
function setHitTestVisible(id){
|
||||
d.hitTestList.push(id)
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,9 @@ Item {
|
||||
property int cellHeight: 38
|
||||
property int cellWidth: 300
|
||||
property bool hideNavAppBar: false
|
||||
property alias buttonMenu: btn_menu
|
||||
property alias buttonBack: btn_back
|
||||
property alias imageLogo: image_logo
|
||||
signal logoClicked
|
||||
id:control
|
||||
Item{
|
||||
@ -755,7 +758,7 @@ Item {
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
id:btn_nav
|
||||
id:btn_menu
|
||||
iconSource: FluentIcons.GlobalNavButton
|
||||
iconSize: 15
|
||||
Layout.preferredWidth: d.isMinimal ? 30 : 0
|
||||
@ -787,7 +790,7 @@ Item {
|
||||
Layout.preferredWidth: 20
|
||||
source: control.logo
|
||||
Layout.leftMargin: {
|
||||
if(btn_nav.visible){
|
||||
if(btn_menu.visible){
|
||||
return 12
|
||||
}
|
||||
return 5
|
||||
@ -1337,13 +1340,4 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
function backButton(){
|
||||
return btn_back
|
||||
}
|
||||
function navButton(){
|
||||
return btn_nav
|
||||
}
|
||||
function logoButton(){
|
||||
return image_logo
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user