example: minor fix to gettingStarted - part5
Do not compare a QString to "". Instead use the .isEmpty() method. Change-Id: Ifda1361b2c288dd590f0294daacdf5e2d9241522 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Geir Vattekar <geir.vattekar@nokia.com>
This commit is contained in:
parent
a02d1ac962
commit
5243999c3c
@ -89,7 +89,7 @@ void Notepad::open()
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
|
||||
tr("Text Files (*.txt);;C++ Files (*.cpp *.h)"));
|
||||
|
||||
if (fileName != "") {
|
||||
if (!fileName.isEmpty()) {
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not open file"));
|
||||
@ -107,7 +107,7 @@ void Notepad::save()
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "",
|
||||
tr("Text Files (*.txt);;C++ Files (*.cpp *.h)"));
|
||||
|
||||
if (fileName != "") {
|
||||
if (!fileName.isEmpty()) {
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
// error message
|
||||
|
Loading…
Reference in New Issue
Block a user