Closed bongbui321 closed 5 months ago
Thanks for the contribution!
Can you maybe also paste the compilation error you get without this patch to se if we can work around it in another way. If we can't, we probably need to add some sanity checks where Style
is used.
Here is the error, thank you for the quick response. Also do you happen to know if qt5 location private dev will be available on the upcoming ubuntu 24.04? it seems that it is not available on 20.04 and 22.04 (I'm not sure on this one)
In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/QVector:1,
from /home/bongb/maplibre-native-qt/src/core/types.hpp:14,
from /home/bongb/maplibre-native-qt/build/src/core/include/QMapLibre/Types:1,
from /home/bongb/maplibre-native-qt/src/core/settings.hpp:10,
from /home/bongb/maplibre-native-qt/src/core/settings.cpp:6:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h: In instantiation of ‘void QVector<T>::reallocData(int, int, QArrayData::AllocationOptions) [with T = QMapLibre::Style; QArrayData::AllocationOptions = QFlags<QArrayData::AllocationOption>]’:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:705:20: required from ‘void QVector<T>::append(T&&) [with T = QMapLibre::Style]’
/home/bongb/maplibre-native-qt/src/core/settings.cpp:456:109: required from here
/usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:607:33: error: no matching function for call to ‘QMapLibre::Style::Style()’
607 | new (dst++) T();
| ^~~~~~~~~~~~~~~
In file included from /home/bongb/maplibre-native-qt/build/src/core/include/QMapLibre/Types:1,
from /home/bongb/maplibre-native-qt/src/core/settings.hpp:10,
from /home/bongb/maplibre-native-qt/src/core/settings.cpp:6:
/home/bongb/maplibre-native-qt/src/core/types.hpp:45:14: note: candidate: ‘QMapLibre::Style::Style(QString, QString)’
45 | explicit Style(QString url_, QString name_ = QString())
| ^~~~~
/home/bongb/maplibre-native-qt/src/core/types.hpp:45:14: note: candidate expects 2 arguments, 0 provided
/home/bongb/maplibre-native-qt/src/core/types.hpp:29:31: note: candidate: ‘QMapLibre::Style::Style(const QMapLibre::Style&)’
29 | struct Q_MAPLIBRE_CORE_EXPORT Style {
| ^~~~~
/home/bongb/maplibre-native-qt/src/core/types.hpp:29:31: note: candidate expects 1 argument, 0 provided
/home/bongb/maplibre-native-qt/src/core/types.hpp:29:31: note: candidate: ‘QMapLibre::Style::Style(QMapLibre::Style&&)’
/home/bongb/maplibre-native-qt/src/core/types.hpp:29:31: note: candidate expects 1 argument, 0 provided
[ 94%] Building CXX object src/core/CMakeFiles/Core.dir/style/layer_parameter.cpp.o
make[2]: *** [src/core/CMakeFiles/Core.dir/build.make:146: src/core/CMakeFiles/Core.dir/settings.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:365: src/core/CMakeFiles/Core.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
91e64b0
) 45.27% compared to head (89a352f
) 45.27%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
OK, can you then maybe protect your change for Qt versions below 5.15 using
#if QT_VERSION M QT_VERSION_CHECK(5, 15, 0)
and so that for supported versions we explicitly require the first argument.
Added sanity check
This helps solves the problem of compiling with Qt 5.12, making it possible to create
Styles
withQVector