cengels/skywriter

Migration to Qt 6

cengels opened this issue · 0 comments

The current development build uses the Qt version 5.14.2. There are two essential versions after 5.14.2: the last version of Qt 5 (5.15.2) and the first version of Qt 6 (currently Qt 6.0.0).

As of this moment, the version must remain 5.14.2. This issue will describe why.

Qt 6.0.0

Qt 6 is the next major release of Qt. It brings with it many changes and improvements, especially in regards to QML, which Skywriter makes heavy use of. For example, Qt 6 no longer requires explicit module versions to be specified in import statements.

However, Qt 6 was developed with a fixed deadline and unfortunately the developers (possibly because of COVID-19, possibly due to poor management) were unable to meet this deadline. As a result, only the most essential Qt modules are part of Qt 6.0, while the remaining modules have been temporarily removed while they are still being worked on. QtQuick Dialogs are one module affected by this. To demonstrate the point: Qt 5.14.2 is over 30 GBs large while Qt 6.0 is only 8 GBs, indicating that over three quarters of the functionality is still missing.

Much of that functionality will likely return in future Qt 6 major versions. There are a number of exceptions to this though. One exception is the QML module QtGraphicalEffects, which has been completely removed from Qt 6. It can still be downloaded as a standalone module, but there is no documentation on how to embed and use it in a QtQuick project. Therefore, migration to Qt 6 should be deferred until sufficient documentation exists to facilitate this migration.

Qt 6 also brings with it a number of API changes, including the removal of deprecated functionality and changes in function signatures. A large part of these API changes are already implemented in branches/qt6.

Qt 5.15.2

Since the migration to Qt 6 is currently not an option, it might be reasonable to at least migrate to the last Qt 5 major version, which is Qt 5.15.2. This, while possible, is however not feasible due to a critical bug Qt 5.15 introduces: namely that recomputing a large QTextDocument takes a significant amount of time in Qt 5.15. In Qt 5.14, the recomputation is instant regardless of the size of the QTextDocument or its contents. In Qt 5.15, the recomputation takes an exponential amount of time relative to the size of its contents. In medium-sized documents it can take over 10 seconds. In large documents (like those common to a full-sized novel) it can take over 30 seconds, which will be enforced every time the user loads a file or switches themes.

Needless to say, this is an unacceptable regression. Therefore Qt 5.14.2 must remain the currently used version.

It's disappointing, because the TextArea already had poor performance in large text documents in Qt 5.14 and below, hence why I implemented my own QtQuick text area with a custom rendering algorithm. I had hoped the support for large text areas would improve in future Qt versions, not get worse.

Of course, there is no guarantee that the bug Qt 5.15 introduced is not also present in Qt 6. Therefore, if and when the migration to Qt 6 is finally attempted, this is something that should be tested first, before all else. Unless Qt 6 improves its TextArea at any point in the future, there is no pressing reason to migrate to Qt 6 anyway.