qt - qml对话框删除确定按钮
问题描述
我想在没有 ok 按钮的 qml 中创建一个自定义对话框。这是我的代码:
Dialog {
id: DialogId
title: appName
}
当对话框打开时,有一个确定按钮。我正在使用 QtQuick.Dialogs 1.2
解决方案
属性standardButtons
控件的按钮在您的对话框中。
默认值为StandardButton.Ok
如果您不需要任何按钮,则需要重新实现contentItem
例如:
contentItem: Rectangle {
color: "lightskyblue"
implicitWidth: 400
implicitHeight: 100
Text {
text: "Hello blue sky!"
color: "navy"
anchors.centerIn: parent
}
}
推荐阅读
- java - 如何在队列类型列表中搜索一个项目,然后在 Java 中更改它?
- apache-kafka - 春季靴卡夫卡消费者滞后?怎么修?
- javascript - 如何将当前频道提及到另一个频道
- python - 将具有分类数据的列转换为每个类别的单独列,并将相应列的变量数据转置为行
- bitbucket - 将常规 Bitbucket 分支更改为发布分支?
- kubernetes - Docker 桌面上的 Kubernetes 入口
- ruby-on-rails - Rails:从 Rails 触发和调度事件
- python - 执行 INSERT 查询的 asyncpg 语法错误
- r - 如果等于列,则有条件地删除第一个字母字符串
- css - React DataGrid 单行自定义