QtHelp: Don't create a collection file in read-only mode


QHelpEngineCore is read-only by default, but opening a QSqlDatabase
creates the file when it doesn't exist. So setupData() left an empty
collection file behind and still returned true, without the tables,
which are only created in fully writable mode. The failure surfaced
much later as a misleading "Cannot register namespace ..." error.

Check that the collection file exists and is not empty before opening
the database in read-only mode, and report the problem right away.

In addition, mark Assistant's cached collection as writable again. It
doesn't exist on the first run and is written to right afterwards, so
ever since read-only became the default it has been relying on the file
creation described above, failing on the first run with exactly that
"Cannot register namespace ..." error.

Amends: 9f1f265c6d3da31f8990240ae48cc66f373aee22
Amends: 15d7a30d41b423846fc74d9dd252c1e2a84769e2

Fixes: QTBUG-150084
Pick-to: 6.12 6.8
Change-Id: I8cd0be5240a9a8b50111f426bb6097ed365080f0
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
commit706585f711f493808e6d88eba27432d0e6797a83
parent376ec09e4f41d5986be28ac1da1a6bce347b2af7
authorJarek Kobus <jaroslaw.kobus@qt.io>
committerJarek Kobus <jaroslaw.kobus@qt.io>
commit timeThu, 1 Oct 2026 15:03:26 +0000