【发布时间】:2013-01-27 02:59:07
【问题描述】:
我是 Qt 的新手,我在它的 Getting Started 页面上学习。我想知道以下语句是什么意思,为什么需要它们?
在打开函数中:
if (!file.open(QIODevice::ReadOnly)) {
QMessageBox::critical(this, tr("Error"), tr("Could not open file"));
return;
}
同样在保存功能中:
if (!file.open(QIODevice::WriteOnly)) {
// error message
}
如果没有这些行,我将无法运行这些函数。我尝试阅读文档中有关错误处理的内容,但无法准确找到这些语句的含义。
【问题讨论】:
标签: qt readonly writeonly qiodevice