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
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 |
根据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 关联的外壳表面项。它将反过来管理此项目的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 |
该属性保存QtShellChrome 的窗口标志。它们将与关联的QtShellSurface 的windowFlags
属性匹配,除非该属性等于 Qt.Window。在这种情况下,将使用一组默认窗口标志。默认窗口标志是 Qt.Window、Qt.WindowMaximizeButtonHint、Qt.WindowMinimizeButtonHint 和 Qt.WindowCloseButtonHint。
windowState : int |
该属性保存外壳表面的窗口状态。当合成器端请求窗口状态时,它会在客户端确认之前立即更新。因此,它在短时间内可能与 shell 表面的windowState
属性不同,后者将在客户端确认请求后更新。
方法文档
void activate() |
手动激活此窗口。这也会唤醒窗口。
另请参阅 raise().
void deactivate() |
手动停用此窗口。如果窗口处于激活状态,则会激活堆栈中的下一个窗口。
void lower() |
降低该窗口,使其堆叠在其他窗口下方(除非其他窗口的窗口标志禁止这样做。)
void raise() |
升高此窗口,使其堆叠在其他窗口之上(除非其他窗口的窗口标志禁止这样做。)
void toggleFullScreen() |
在全屏和正常窗口状态之间切换。如果设置了最小化或最大化窗口状态,本方法也会清除这两种状态。
void toggleMaximized() |
在最大化和正常状态之间切换。如果设置了最小化窗口状态,此方法也会清除该状态。
void toggleMinimized() |
在最小化和正常状态之间切换。如果设置了最大化窗口状态,该方法也会清除该状态。
© 2025 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.