QtShellChrome QML Type
提供用于配合qt-shell 扩展使用的默认窗口管理器功能。更多内容...
| Import Statement: | import QtWayland.Compositor.QtShell |
| Since: | Qt 6.3 |
属性
- bottomLeftResizeHandle : Item
- bottomResizeHandle : Item
- bottomRightResizeHandle : Item
- frameMarginBottom : int
- frameMarginLeft : int
- frameMarginRight : int
- frameMarginTop : int
- hasDecorations : bool
- leftResizeHandle : Item
- maximizedRect : rect
- rightResizeHandle : Item
- shellSurfaceItem : ShellSurfaceItem
- titleBar : Item
- topLeftResizeHandle : Item
- topResizeHandle : Item
- topRightResizeHandle : Item
- windowFlags : int
- windowState : int
方法
- void activate()
- void deactivate()
- void lower()
- void raise()
- void toggleFullScreen()
- void toggleMaximized()
- void toggleMinimized()
详细说明
QtShellChrome 是一种便捷类型,可用于通过qt-shell 壳扩展协议向客户端交互提供窗口管理器功能。
给定一个关联了QtShellSurface 的ShellSurfaceItem ,该项将自动调整其大小以匹配该表面。它还将自动处理以下内容:
- 窗口状态,例如最大化、最小化和全屏。
- 窗口激活。
- 使用调整大小控点调整窗口大小(如果设置了相应的属性)。
- 通过标题栏交互进行窗口重新定位(如果已设置titleBar 属性)。
QtShellChrome 旨在与QtShell 和QtShellSurface 配合使用。
另请参阅 QtShell Compositor。
属性文档
bottomLeftResizeHandle : Item
该属性保存了QtShellChrome 的默认左下角调整大小控点。如果设置了该属性,将在调整大小控点上安装一个DragHandler ,该控点通过以相等幅度移动窗口的底部和左侧边缘来调整窗口大小。
该控制柄会根据窗口标志和窗口的全屏状态自动隐藏或显示。
QtShellChrome {
Rectangle {
id: blrh
anchors.bottom: parent.bottom
anchors.left: parent.left
height: 5
width: 5
color: "white"
}
bottomLeftResizeHandle: blrh
}bottomResizeHandle : Item
该属性存储QtShellChrome 的默认底部调整大小控点。如果设置了该属性,将在调整大小控点上安装一个DragHandler ,该控点通过移动窗口的底部边缘来调整窗口大小。
该控件将根据窗口标志和窗口的全屏状态自动隐藏或显示。
QtShellChrome {
Rectangle {
id: brh
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
height: 5
color: "white"
}
bottomResizeHandle: brh
}注意:除非 显式设置了边框边距,否则 该控件的高度将计入窗口底部边框边距中。
bottomRightResizeHandle : Item
该属性保存QtShellChrome 的默认右下角调整大小控点。若设置此属性,将在调整大小控点上安装一个DragHandler ,该控点通过以相等幅度移动窗口的底部和右侧边缘来调整窗口大小。
该控制柄会根据窗口标志和窗口的全屏状态自动隐藏和显示。
QtShellChrome {
Rectangle {
id: brrh
anchors.bottom: parent.bottom
anchors.right: parent.right
height: 5
width: 5
color: "white"
}
bottomRightResizeHandle: brrh
}frameMarginBottom : int
设置QtShellChrome 底部留给窗口装饰的边距大小。默认情况下,如果bottomResizeHandle 已设置,则该值将等于其高度;否则,该值为0。
注意:通过 显式设置此属性,所有默认的框架边距都将被相应的属性覆盖。
frameMarginLeft : int
设置QtShellChrome 左边距的大小,该边距用于保留窗口装饰。默认情况下,如果已设置leftResizeHandle ,则该值将等于 的宽度;否则,该值为0。
注意:通过 显式设置此属性,所有默认框架边距都将被相应的属性所覆盖。
frameMarginRight : int
设置QtShellChrome 右边距的大小,该边距用于保留窗口装饰。默认情况下,如果已设置rightResizeHandle ,则该值将等于 的宽度;否则,该值为0。
注意:通过 显式设置此属性,所有默认框架边距都将被相应的属性覆盖。
frameMarginTop : int
设置QtShellChrome 顶部留给窗口装饰的边距大小。默认情况下,该值等于leftResizeHandle 和titleBar 高度之和(如果已设置)。否则,该值为0。
注意:通过 显式设置此属性,所有默认框架边距都将被相应的属性所覆盖。
hasDecorations : bool [read-only]
如果根据QtShellChrome 的窗口状态和窗口标志,其装饰应可见,则此属性为true。
leftResizeHandle : Item
该属性保存了QtShellChrome 的默认左侧调整大小控点。如果设置了该属性,将在调整大小控点上安装一个DragHandler ,该控点通过移动窗口的左边缘来调整窗口大小。
该控件将根据窗口标志和窗口的全屏状态自动隐藏或显示。
QtShellChrome {
Rectangle {
id: lrh
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 5
color: "white"
}
leftResizeHandle: lrh
}注意:除非 显式设置了边框边距,否则 该控件的宽度将计入窗口的左侧边框边距中。
maximizedRect : rect
该属性存储了WaylandOutput 的面积,窗口处于最大化状态时可填充该区域。默认情况下,窗口最大化时将填充WaylandOutput 的整个几何区域。修改该属性在某些情况下可能很有用,例如当合成器存在其他系统用户界面(如任务栏)时,这些界面不应被最大化的应用程序遮挡。
rightResizeHandle : Item
该属性保存QtShellChrome 的默认右侧调整大小控点。如果设置了该属性,将在调整大小控点上安装一个DragHandler ,该控点通过移动窗口的右边缘来调整窗口大小。
该控件将根据窗口标志和窗口的全屏状态自动隐藏和显示。
QtShellChrome {
Rectangle {
id: rrh
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 5
color: "white"
}
rightResizeHandle: rrh
}注意:除非 显式设置了边框边距,否则 该控件的宽度将包含在窗口的右边框边距中。
shellSurfaceItem : ShellSurfaceItem
该属性保存与该QtShellChrome 关联的shell表面项。它将进而管理该项的shellSurface 。该项的shellSurface 应为QtShellSurface 类型。
QtShellChrome {
id: chrome
ShellSurfaceItem {
id: sfi
anchors.fill: parent
moveItem: chrome
}
shellSurfaceItem: sfi
}titleBar : Item
该属性保存了QtShellChrome 的默认标题栏控件。如果设置了该属性,标题栏上将安装一个DragHandler ,用户与之交互时可移动窗口。此外,点击标题栏时,窗口将自动激活。
标题栏将根据窗口标志和窗口的全屏状态自动隐藏或显示。
QtShellChrome {
Rectangle {
id: tb
anchors.top: parent.top
anchors.right: parent.right
anchors.left: parent.left
height: 50
color: "black"
Text {
color: "white"
anchors.centerIn: parent
text: shellSurfaceItem.shellSurface.windowTitle
font.pixelSize: 25
}
}
titleBar: tb
}注意:除非 显式设置了边框边距,否则 标题栏的高度将包含在窗口的顶部边框边距中。
topLeftResizeHandle : Item
该属性保存QtShellChrome 的默认左上角调整大小控点。如果设置了该属性,将在调整大小控点上安装一个DragHandler ,该控点通过以相等幅度移动窗口的顶部和左侧边缘来调整窗口大小。
该控制柄将根据窗口标志和窗口的全屏状态自动隐藏或显示。
QtShellChrome {
Rectangle {
id: tlrh
anchors.top: parent.top
anchors.left: parent.left
height: 5
width: 5
color: "white"
}
topLeftResizeHandle: tlrh
}topResizeHandle : Item
该属性存储QtShellChrome 的默认顶部调整大小控点。如果设置了该属性,将在调整大小控点上安装一个DragHandler ,该控点通过移动窗口的顶部边缘来调整窗口大小。
该控制柄将根据窗口标志和窗口的全屏状态自动隐藏或显示。
QtShellChrome {
Rectangle {
id: trh
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: 5
color: "white"
}
topResizeHandle: trh
}注意:除非 显式设置了边框间距,否则 该控件的高度将计入窗口顶部边框间距中。
topRightResizeHandle : Item
该属性保存了QtShellChrome 的默认右上角调整大小控点。如果设置了该属性,则会在调整大小控点上安装一个DragHandler ,该控点通过以相等幅度移动窗口的顶部和右侧边缘来调整窗口大小。
该控制柄会根据窗口标志和窗口的全屏状态自动隐藏或显示。
QtShellChrome {
Rectangle {
id: trrh
anchors.top: parent.top
anchors.right: parent.right
height: 5
width: 5
color: "white"
}
topRightResizeHandle: trrh
}windowFlags : int [read-only]
该属性保存QtShellChrome 的窗口标志。这些标志将与关联的QtShellSurface 的windowFlags 属性保持一致,除非该属性等于Qt.Window。在这种情况下,将改用一组默认窗口标志。 默认窗口标志包括 Qt.Window、Qt.WindowMaximizeButtonHint、Qt.WindowMinimizeButtonHint 和 Qt.WindowCloseButtonHint。
windowState : int [read-only]
该属性保存了外壳表面的窗口状态。当合成器端请求窗口状态时,该属性会立即更新,而此时客户端尚未对此请求进行确认。因此,在短时间内,该属性可能与外壳表面的windowState 属性存在差异——后者将在客户端确认请求后进行更新。
方法文档
void activate()
手动激活此窗口。这也会将该窗口置于最前。
另请参阅 raise()。
void deactivate()
手动将此窗口设为非活动状态。如果该窗口处于活动状态,此操作将转而激活堆栈中的下一个窗口。
void lower()
将此窗口下移,使其位于其他窗口下方(除非其他窗口的窗口标志禁止此操作)。
void raise()
将此窗口置顶,使其显示在其他窗口之上(除非其他窗口的标志禁止此操作)。
void toggleFullScreen()
在全屏和普通窗口状态之间切换。如果窗口处于最小化或最大化状态,此方法还会清除该状态。
void toggleMaximized()
在最大化状态和正常状态之间切换。如果窗口处于最小化状态,此方法还会将其清除。
void toggleMinimized()
在最小化状态和正常状态之间切换。如果窗口处于最大化状态,此方法还会将其重置为最小化状态。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.