最简单的Qt对话框

Simplest Qt Dialog

本文关键字:对话框 Qt 最简单      更新时间:2023-10-16

我有一个C++函数,用于检查蓝牙是否已激活。我想显示一个简单的对话框,告诉用户激活蓝牙并重试。由于我有一个QML接口,这可以通过C++或QML来完成。

您可以使用内置的信息消息框:

#include <QApplication>
#include <QDebug>
#include <QMessageBox>
int main(int argc, char *argv[]) {
    QApplication app(argc, argv);
    QMessageBox::information(0, "Try Again", "Please try to activate your Bluetooth again.");
}

Qt组件有一些开箱即用的对话框:http://doc.qt.nokia.com/qt-components-symbian-1.0/qml-querydialog.html