Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create struc Style with empty url possible #107

Merged
merged 2 commits into from
Jan 28, 2024
Merged

Conversation

bongbui321
Copy link
Contributor

This helps solves the problem of compiling with Qt 5.12, making it possible to create Styles with QVector

@ntadej
Copy link
Collaborator

ntadej commented Jan 28, 2024

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.

@bongbui321
Copy link
Contributor Author

bongbui321 commented Jan 28, 2024

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

Copy link

codecov bot commented Jan 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (91e64b0) 45.27% compared to head (89a352f) 45.27%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #107   +/-   ##
=======================================
  Coverage   45.27%   45.27%           
=======================================
  Files          35       35           
  Lines        2125     2125           
=======================================
  Hits          962      962           
  Misses       1163     1163           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ntadej
Copy link
Collaborator

ntadej commented Jan 28, 2024

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.

@bongbui321
Copy link
Contributor Author

Added sanity check

@ntadej ntadej merged commit 3726266 into maplibre:main Jan 28, 2024
31 checks passed
@ntadej ntadej added this to the 3.0 milestone Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants