olive-editor / olive

Free open-source non-linear video editor
https://olivevideoeditor.org/
GNU General Public License v3.0
8.03k stars 544 forks source link

[BUILD] 066a10e6 causes QT6 builds to fail #2200

Open MatthewCroughan opened 1 year ago

MatthewCroughan commented 1 year ago

Commit Hash

066a10e6

Platform

Linux

Summary

Whilst creating a reproducible Nix derivation for olive-editor. I was building for QT6 and found via a bisect that 066a10e6 causes builds with QT6 to fail like this

olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp: In member function 'virtual olive::ProjectSerializer::LoadData olive::ProjectSerializer230220::Load(olive::Project*, QXmlStreamReader*, olive::ProjectSerializer::LoadType, void*) const':
olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp:192:23: error: 'QStringRef' was not declared in this scope; did you mean 'QStringView'?
olive-editor-unstable>   192 |               QVector<QStringRef> l = attr.value().split(',');
olive-editor-unstable>       |                       ^~~~~~~~~~
olive-editor-unstable>       |                       QStringView
olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp:192:33: error: template argument 1 is invalid
olive-editor-unstable>   192 |               QVector<QStringRef> l = attr.value().split(',');
olive-editor-unstable>       |                                 ^
olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp:192:57: error: cannot convert 'QList<QStringView>' to 'int' in initialization
olive-editor-unstable>   192 |               QVector<QStringRef> l = attr.value().split(',');
olive-editor-unstable>       |                                       ~~~~~~~~~~~~~~~~~~^~~~~
olive-editor-unstable>       |                                                         |
olive-editor-unstable>       |                                                         QList<QStringView>
olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp:193:31: error: request for member 'size' in 'l', which is of non-class type 'int'
olive-editor-unstable>   193 |               items.reserve(l.size());
olive-editor-unstable>       |                               ^~~~
olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp:194:26: error: 'QStringRef' does not name a type; did you mean 'QStringView'?
olive-editor-unstable>   194 |               for (const QStringRef &s : l) {
olive-editor-unstable>       |                          ^~~~~~~~~~
olive-editor-unstable>       |                          QStringView
olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp:196:16: error: expected ';' before '}' token
olive-editor-unstable>   196 |               }
olive-editor-unstable>       |                ^
olive-editor-unstable>       |                ;
olive-editor-unstable>   197 |             }
olive-editor-unstable>       |             ~
olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp:197:13: error: expected primary-expression before '}' token
olive-editor-unstable>   197 |             }
olive-editor-unstable>       |             ^
olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp:196:16: error: expected ';' before '}' token
olive-editor-unstable>   196 |               }
olive-editor-unstable>       |                ^
olive-editor-unstable>       |                ;
olive-editor-unstable>   197 |             }
olive-editor-unstable>       |             ~
olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp:197:13: error: expected primary-expression before '}' token
olive-editor-unstable>   197 |             }
olive-editor-unstable>       |             ^
olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp:196:16: error: expected ')' before '}' token
olive-editor-unstable>   196 |               }
olive-editor-unstable>       |                ^
olive-editor-unstable>       |                )
olive-editor-unstable>   197 |             }
olive-editor-unstable>       |             ~
olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp:194:19: note: to match this '('
olive-editor-unstable>   194 |               for (const QStringRef &s : l) {
olive-editor-unstable>       |                   ^
olive-editor-unstable> /build/source/app/node/project/serializer/serializer230220.cpp:197:13: error: expected primary-expression before '}' token
olive-editor-unstable>   197 |             }
olive-editor-unstable>       |             ^

Additional Information / Output

Every commit after 06a10e6 builds successfully with QT5.

The reason I am creating this derivation is to update the very out of date Nix package

MatthewCroughan commented 1 year ago

The reason is because QStringRef is removed in Qt6, so you'll need to port this to use QStringView instead. You could use Qt5Compat, but Is there a valid reason to cling to Qt5 support since Qt5 is now deprecated? Let's get rid of Qt5 altogether in the Makefile and make Qt6 default.

MatthewCroughan commented 1 year ago

I can confirm that simply renaming QStringRef to QStringView in the following files works:

./app/node/project/serializer/serializer.h
./app/node/project/serializer/serializer.cpp
./app/node/project/serializer/serializer230220.cpp

I believe this will break QT5 builds, not entirely sure. I won't make a patch for this since the choice is yours as to whether to get rid of QT5 and replace with QT6.

MatthewCroughan commented 1 year ago

https://github.com/NixOS/nixpkgs/pull/222710

itsmattkc commented 1 year ago

Is there a valid reason to cling to Qt5 support since Qt5 is now deprecated?

There are still some unresolved UI issues that get introduced when compiling with Qt 6. From memory, it's mostly mouse related issues pertaining to the sliders, though I can't remember fully and haven't really tested since first adding Qt 6 support. There's also an argument that there are still OSes in use that Olive officially supports and that Qt 6 doesn't, however this is obviously becoming less the case over time.

MatthewCroughan commented 1 year ago

I've been using the latest commit on Wayland QT6 for more than 24 hours now, it's rock solid and I'm blown away by olive in general. It is state of the art.

The mouse/cursor does not change its appearance on various parts of the UI such as when enlarging clips, but I really do not mind that at all, if that's the bug you're referring to.

Simran-B commented 1 year ago

The current target is CY2022, but CY2023 is also Qt 5. It will be Qt 6 for CY2024: http://vfxplatform.com/

Quackdoc commented 1 year ago

I can confirm that simply renaming QStringRef to QStringView in the following files works:

if the changes are as simple as this, it probably warrants just using #ifdef to keep support for both. it should be clean enough to remove if/when the decision to deprecate QT5 is made

itsmattkc commented 1 year ago

I agree that this should be solved with ifdefs.

ThomasWilshaw commented 10 months ago

There have been several commits upgrading QT6 support, is the issue still relevant?