[Interest] Calling QSettings::value() with an empty key name triggers an assert

Etienne Sandré-Chardonnal etienne.sandre at m4x.org
Wed Oct 2 17:35:04 CEST 2013

Dear all,

I'm under windows, where registry supports a default value per key. This
means, a value with an empty name.

Using QSettings::setValue("", value) and QSettings::value("") works fine
and as expected in release mode. It creates and read default values in the

However, I was surprised that in debug mode, this triggers an assert due to
the empty string.

I think that:
1) This may be due to empty names which are not supported in other
platforms. In that case, it should be stated in the doc that the name must
not be empty.
2) Calling an Q_ASSERT on this is quite rude... It should fail but cleanly,
maybe with a qWarning.
3) Isn't there a way to port empty value names to other platforms?

Qt 4.8.1, should a bug be filed?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131002/ddf20a92/attachment.html>

More information about the Interest mailing list