BlackBerry 10 - Dialog Box
BlackBerry 10 - Dialog Box
我正在开发一个用于联系人阅读的应用程序。在联系人添加页面中,我创建了一些文本字段,如名字、姓氏、电话号码等。我还创建了一个ActionItem来保存或创建联系人。像这个
acceptAction: ActionItem {
title: (_contactRead.contactEditor.mode == ContactEditor.CreateMode ? qsTr ("Create" ) : qsTr ("Save"))
onTriggered: {
_contactRead.contactEditor.saveContact()
navigationPane.pop()
}
}
当我们点击保存或创建联系人时,我想显示弹出窗口(对话框或toast)。我试图在onTriggered中添加open(),但对如何以及在哪里创建对话框感到困惑。
请帮帮我。。。。
使用-->警报(tr("已保存联系人");
参考以下样本
-----------qml--------------
Button {
horizontalAlignment: HorizontalAlignment.Center
text: qsTr("Update")
onClicked: {
_app.updateRecord(idUpdateTextField.text, firstNameUpdateTextField.text, lastNameUpdateTextField.text);
}
}
-----------------cpp文件------------------
bool App::updateRecord(const QString &customerID, const QString &firstName, const QString &lastName)
{
bool intConversionGood = false;
const int customerIDKey = customerID.toInt(&intConversionGood);
if (!intConversionGood) {
alert(tr("You must provide valid integer key."));
return false;
}
QSqlDatabase database = QSqlDatabase::database();
QSqlQuery query(database);
const QString sqlCommand = "UPDATE customers "
" SET firstName = :firstName, lastName = :lastName"
" WHERE customerID = :customerID";
query.prepare(sqlCommand);
query.bindValue(":firstName", firstName);
query.bindValue(":lastName", lastName);
query.bindValue(":customerID", customerIDKey);
bool updated = false;
if (query.exec()) {
if (query.numRowsAffected() > 0) {
alert(tr("Customer with id=%1 was updated.").arg(customerID));
updated = true;
} else {
alert(tr("Customer with id=%1 was not found.").arg(customerID));
}
} else {
alert(tr("SQL error: %1").arg(query.lastError().text()));
}
database.close();
return updated;
}
对于此处的示例应用程序
相关文章:
- 什么是"MFC Dialog Extension"?(Windows/C++ 新手 - Linux 背景)
- C++:从盒装元素的向量构造 Box 类型的向量
- QInputDialog & Ththreader(worker,show dialog,等待输入,继续)
- 为什么我们选择"bounding box"方法来填充三角形?
- Box muller distribution
- Box Muller Transform在实现正态分布PRNG时的问题
- 我的"out of the box"程序可以在 Windows 中在哪里可靠地创建目录?
- 在Message Box Husing手柄中显示DLL的路径
- 如何以编程方式为应用程序创建文件夹,以使用 BOX REST API 在其中上传内容
- AIX Box 程序中C++跟踪/BPT 陷阱
- QInput Dialog-按enter键确认
- 将 Gtk::Grid 重复添加到 Gtk::Box
- 如何在box.get_string()中使用FLTK
- MFC 应用程序 Dialog基于使用 propertyPage,DoModal() for a CDialog 不打开任何对话框
- 将文件上传到 box.net
- 启动 VirtualBoxSDK 测试应用程序返回错误"Error creating virtual box instance"
- 无法打开包含文件:'mvvm/dialog.h'
- BlackBerry 10 - Dialog Box
- 使用ATL调用Dialog.DoModal在Windows CE 6.0上不起作用
- C++中的Box滤波算法