diff mbox series

[3/7] kconfig: qconf: use preferred form of QString API

Message ID 3317655.aeNJFYEL58@devpool47.emlix.com (mailing list archive)
State New
Headers show
Series improve qconfig C++ code | expand

Commit Message

Rolf Eike Beer Oct. 23, 2024, 6:32 a.m. UTC
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
---
 scripts/kconfig/qconf.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Masahiro Yamada Oct. 23, 2024, 4:38 p.m. UTC | #1
The code looks good to me, but please describe something
in the commit message body.

For example, you can quote:
"We recommend that you always use the isEmpty() function and avoid isNull()"
from the QString documentation. [1]

[1] https://doc.qt.io/qt-6/qstring.html#distinction-between-null-and-empty-strings




On Wed, Oct 23, 2024 at 3:32 PM Rolf Eike Beer <eb@emlix.com> wrote:
>
> Signed-off-by: Rolf Eike Beer <eb@emlix.com>
> ---
>  scripts/kconfig/qconf.cc | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> index 54640f6b29e2..6a653ebe9df3 100644
> --- a/scripts/kconfig/qconf.cc
> +++ b/scripts/kconfig/qconf.cc
> @@ -1520,8 +1520,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()))
> @@ -1547,8 +1547,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())) {
> --
> 2.47.0
>
>
> --
> Rolf Eike Beer
>
> emlix GmbH
> Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
> Phone +49 (0)551 30664-0, e-mail info@emlix.com
> District Court of Göttingen, Registry Number HR B 3160
> Managing Directors: Heike Jordan, Dr. Uwe Kracke
> VAT ID No. DE 205 198 055
> Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
> Office Bonn: Bachstr. 6, 53115 Bonn, Germany
> http://www.emlix.com
>
> emlix - your embedded Linux partner
>
>


--
Best Regards
Masahiro Yamada
diff mbox series

Patch

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 54640f6b29e2..6a653ebe9df3 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1520,8 +1520,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()))
@@ -1547,8 +1547,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())) {