qt - QML 中的 QMessageBox::aboutQt 等价物是什么?
问题描述
QMessageBox::aboutQt
QML 中是否可以使用等效项?我没有在QtQuick.Dialogs
模块中找到任何合适的东西(https://doc.qt.io/qt-5/qtquickdialogs-index.html)。
解决方案
QMessageBox::about
与 QML最接近的匹配MessageDialog
设置如下:
import QtQuick 2.2
import QtQuick.Dialogs 1.1
MessageDialog {
title: "Your title"
icon: StandardIcon.Information
text: "Your text"
standardButtons: StandardButton.Ok
Component.onCompleted: visible = true
}
至于QMessageBox::aboutQt
,根据this topic,在Qt论坛中,没有QML等价物,最好调用qApp->aboutQt
:
阅读文档似乎没有关于 QML 的 Qt。
从 C++ 类调用标准 qApp->aboutQt 可能更好。
推荐阅读
- python - Ubuntu 说 Python 是最新版本,但实际上不是。我如何更新它
- algorithm - 如何在有向图中找到彼此距离 k 的所有节点(探索图中的每条边)?
- java - 什么类型的数组(代码)适用于这个问题?
- python - 如何修复错误:“make”不是内部或外部命令、可运行程序或批处理文件
- javascript - Vue.js 将 getter 存储在变量中时会发生奇怪的事情
- php - PHP 用文本“或”转换分号 (;)
- c++ - 代码块中的清单配置在哪里?
- java - 无法反序列化来自 kafka 主题的 json 字符串,该主题在蛇案例中具有属性
- android - 使用 react-native-firebase v6,应用程序在前台收到通知时崩溃
- c - 错误:在原始套接字中使用 sendto() 时地址错误