kconfig: qconf: use preferred form of QString API
authorRolf Eike Beer <eb@emlix.com>
Thu, 19 Dec 2024 07:20:34 +0000 (08:20 +0100)
committerMasahiro Yamada <masahiroy@kernel.org>
Fri, 10 Jan 2025 14:01:22 +0000 (23:01 +0900)
A QString constructed from a character literal of length 0, i.e. "", is not
"null" for historical reasons. This does not matter here so use the preferred
method isEmpty() instead.

Also directly construct empty QString objects instead of passing in an empty
character literal that has to be parsed into an empty object first.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Link: https://doc.qt.io/qt-6/qstring.html#distinction-between-null-and-empty-strings
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/kconfig/qconf.cc

index 6c92ef1..eaa465b 100644 (file)
@@ -1464,8 +1464,8 @@ void ConfigMainWindow::loadConfig(void)
 {
        QString str;
 
-       str = QFileDialog::getOpenFileName(this, "", configname);
-       if (str.isNull())
+       str = QFileDialog::getOpenFileName(this, QString(), configname);
+       if (str.isEmpty())
                return;
 
        if (conf_read(str.toLocal8Bit().constData()))
@@ -1491,8 +1491,8 @@ void ConfigMainWindow::saveConfigAs(void)
 {
        QString str;
 
-       str = QFileDialog::getSaveFileName(this, "", configname);
-       if (str.isNull())
+       str = QFileDialog::getSaveFileName(this, QString(), configname);
+       if (str.isEmpty())
                return;
 
        if (conf_write(str.toLocal8Bit().constData())) {