RibbonTitleBar: Add support for snap layout in Windows 11+.
This commit is contained in:
parent
57e01f465f
commit
1d25452a4b
|
@ -19,6 +19,12 @@ Window {
|
||||||
return FramelessUtils.defaultSystemLightColor;
|
return FramelessUtils.defaultSystemLightColor;
|
||||||
}
|
}
|
||||||
FramelessHelper.onReady: {
|
FramelessHelper.onReady: {
|
||||||
|
if (Qt.platform.os === 'windows')
|
||||||
|
{
|
||||||
|
FramelessHelper.setSystemButton(titleBar.minimizeBtn, FramelessHelperConstants.Minimize);
|
||||||
|
FramelessHelper.setSystemButton(titleBar.maximizeBtn, FramelessHelperConstants.Maximize);
|
||||||
|
FramelessHelper.setSystemButton(titleBar.closeBtn, FramelessHelperConstants.Close);
|
||||||
|
}
|
||||||
FramelessHelper.titleBarItem = titleBar;
|
FramelessHelper.titleBarItem = titleBar;
|
||||||
FramelessHelper.moveWindowToDesktopCenter();
|
FramelessHelper.moveWindowToDesktopCenter();
|
||||||
window.visible = true;
|
window.visible = true;
|
||||||
|
|
|
@ -16,6 +16,9 @@ Item {
|
||||||
default property alias content: left_container.data
|
default property alias content: left_container.data
|
||||||
property alias left_content: left_container.data
|
property alias left_content: left_container.data
|
||||||
property alias right_content: right_container.data
|
property alias right_content: right_container.data
|
||||||
|
property alias maximizeBtn: maximizeBtn
|
||||||
|
property alias minimizeBtn: minimizeBtn
|
||||||
|
property alias closeBtn: closeBtn
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
@ -78,6 +81,7 @@ Item {
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Layout.rightMargin: Qt.platform.os === "osx" ? -5 : 0
|
Layout.rightMargin: Qt.platform.os === "osx" ? -5 : 0
|
||||||
RibbonButton{
|
RibbonButton{
|
||||||
|
id: closeBtn
|
||||||
show_bg:false
|
show_bg:false
|
||||||
icon_source: RibbonIcons.Dismiss
|
icon_source: RibbonIcons.Dismiss
|
||||||
icon_source_filled: RibbonIcons_Filled.Dismiss
|
icon_source_filled: RibbonIcons_Filled.Dismiss
|
||||||
|
@ -90,6 +94,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
RibbonButton{
|
RibbonButton{
|
||||||
|
id: minimizeBtn
|
||||||
show_bg:false
|
show_bg:false
|
||||||
icon_source: RibbonIcons.Subtract
|
icon_source: RibbonIcons.Subtract
|
||||||
icon_source_filled: RibbonIcons_Filled.Subtract
|
icon_source_filled: RibbonIcons_Filled.Subtract
|
||||||
|
@ -103,6 +108,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
RibbonButton{
|
RibbonButton{
|
||||||
|
id: maximizeBtn
|
||||||
show_bg:false
|
show_bg:false
|
||||||
icon_source: Window.window.visibility === Window.Maximized ? RibbonIcons.ArrowMinimize : RibbonIcons.ArrowMaximize
|
icon_source: Window.window.visibility === Window.Maximized ? RibbonIcons.ArrowMinimize : RibbonIcons.ArrowMaximize
|
||||||
text_color: titleBar.title_text_color
|
text_color: titleBar.title_text_color
|
||||||
|
|
Loading…
Reference in New Issue