cneben / QuickQanava

:link: C++17 network / graph visualization library - Qt6 / QML node editor.
http://cneben.github.io/QuickQanava/index.html
Other
1.16k stars 228 forks source link

Bug: GraphicalEffects{5,6} are installed regardless of Qt version #212

Closed petrmanek closed 10 months ago

petrmanek commented 1 year ago

During installation of QuickQanava, the cmake build system is instructed to install QML source files in addition to headers and binaries. It appears that cmake installs QML files found in src/GraphicalEffects5 as well as src/GraphicalEffects6 regardless of the currently used Qt version. Let me stress that here I am not referring to the actual compilation of these files, which is correctly determined at the time of cmake configuration, but rather the installation of the QML sources intended for debugging purposes.

While this may not in any way affect applications using QuickQanava, simultaneous inclusion of QML files from both directories has significant impacts on distribution. Some package managers are capable of detecting QML import directives, and automatically translate them to package dependencies. For such package managers, including both QML directories may create a phantom dependency on another version of Qt, which is unnecessary and sometimes even cannot be satisfied.

For instance, in openSUSE Tumbleweed and Qt6 rpmbuild automatically creates a dependency on qt6qmlimport(QtGraphicalEffects.1) from any file in src/GraphicalEffects5 in addition to qt6qmlimport(Qt5Compat.GraphicalEffects.1), which can be derived from any file in src/GraphicalEffects6. While the former dependency cannot be satisfied in Tumbleweed OSS repos that provide qt5qmlimport(QtGraphicalEffects.1) but not qt6qmlimport(QtGraphicalEffects.1), the latter is correctly matched to the qt6-qt5compat-imports package. One could easily envision a reciprocal issue with an older Linux distribution, where Qt5 dependencies work while Qt6 dependencies cannot be matched to an appropriate package.

In my current application built with Qt6, I am mitigating this by explicitly deleting the contents of the ${INSTALL_PREFIX}/usr/lib64/qt6/qml/QuickQanava/GraphicalEffects5 directory. However, it would be nice if this was resolved upstream. A fix would probably involve modifying the install target logic, so that rather than mindlessly globbing over src/ it takes into account the current Qt version, much like the code that selects which directory is compiled.

cneben commented 10 months ago

Hi @petrmanek unfortunately theses definitions are necessary for Qt5 since we can't conditionally import in QML (possible in pure Js), so I understand the problem but I have no better solution than your actual workaround. I'am currently working on packaging the next release (lot of work done lately in CMake-Qt5qt6 branch, but no time to merge until now), it will be the last one with Qt5 support and that Qt GraphicalEffect hack. Hopefully shadows/glows will be done with https://www.qt.io/blog/introducing-qt-quick-effect-maker in future release.

petrmanek commented 10 months ago

@cneben Thanks for getting back to this. I understand where you are coming from. Fortunately, for the last several months my workaround proved to be sufficiently robust. For that reason, I feel comfortable supporting it for one or two more minor releases before QuickQanava fully transitions to Qt6. Following that, we can hopefully put this to rest.

Feel free to keep this issue open until such time, or close it now depending on your preferred workflow.