ColorDialog QML Type
颜色对话框更多
Import Statement: | import QtQuick.Dialogs |
Since: | Qt 6.4 |
Inherits: |
属性
- options : flags
- selectedColor : color
详细说明
ColorDialog 类型为颜色对话框提供了 QML API。
要显示颜色对话框,只需构造一个 ColorDialog 实例,设置所需的属性,然后调用open() 即可。selectedColor 属性可用于确定对话框中最初选定的颜色。
MenuItem { text: qsTr("Color") onTriggered: colorDialog.open() } ColorDialog { id: colorDialog selectedColor: document.color onAccepted: document.color = selectedColor } MyDocument { id: document }
可用性
本机平台颜色对话框目前在以下平台上可用:
- iOS
- Linux(使用 GTK+ 平台主题运行时)
- MacOS
Qt Quick Dialogs 在没有本机实现的平台上,使用 实现作为备用。Qt Quick
属性文档
options : flags |
该属性包含影响对话框外观的各种选项。
默认情况下,所有选项都被禁用。
应在显示对话框之前设置选项。在对话框可见时设置这些选项,并不能保证立即对对话框产生影响(取决于选项和平台)。
可用选项
常量 | 说明 |
---|---|
ColorDialog.ShowAlphaChannel | 显示阿尔法值的滑块和附加输入框。 |
ColorDialog.NoButtons | 不显示Open 和Cancel 按钮(对 "实时对话框 "有用)。 |
ColorDialog.NoEyeDropperButton | 不显示Eye Dropper 按钮。此值在 Qt 6.6 中添加。 |
ColorDialog.DontUseNativeDialog | 强制对话框使用非本地快速实现。 |
selectedColor : color |
© 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.