AlexandrePTJ / kemai

Kimai desktop client
MIT License
92 stars 25 forks source link

Is it still possible to build kemai with qt5? removeIf() appears to be qt6-only #53

Closed sdreilinger closed 2 years ago

sdreilinger commented 2 years ago

greetings @AlexandrePTJ & Co:

Building release 0.7.1 on an up-to-date gentoo linux machine fails with:

[ 89%] Building CXX object src/app/CMakeFiles/Kemai.dir/settingsdialog.cpp.o /usr/local/src/kemai-github-alexandre/src/app/settingsdialog.cpp: In member function ‘void kemai::app::SettingsDialog::onProfileDelButtonClicked()’: /usr/local/src/kemai-github-alexandre/src/app/settingsdialog.cpp:219:29: error: ‘class QList<kemai::core::Settings::Profile>’ has no member named ‘removeIf’; did you mean ‘removeAt’? 219 | m_settings.profiles.removeIf([profileId = item->data(Qt::UserRole).toUuid()](const Settings::Profile& profile) { return profile.id == profileId; }); | ^~~~~~~~ | removeAt gmake[2]: *** [src/app/CMakeFiles/Kemai.dir/build.make:259: src/app/CMakeFiles/Kemai.dir/settingsdialog.cpp.o] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:232: src/app/CMakeFiles/Kemai.dir/all] Error 2 gmake: *** [Makefile:156: all] Error 2

I can see that kemai checks for qt6, and falls back to qt5 if qt6 is not found, but removeIf() is listed as a function that is newly introduced in qt6.1.

Does settingsdialog.cpp need an alternative to line 219 if the user has qt5? m_settings.profiles.removeIf([profileId = item->data(Qt::UserRole).toUuid()](const Settings::Profile& profile) { return profile.id == profileId; });

I hope you will continue supporting qt5 for a while longer! Thanks very much --sean

AlexandrePTJ commented 2 years ago

Thanks @sdreilinger for this report. Yes I plan to support Qt5 until 5.15 LTS is deprecated. Sorry for the compilation error. I forgot to add a build job with Qt5 in the CI process. This will be fixed soon.

sdreilinger commented 2 years ago

Thanks very much! Kemai now builds and runs here with Qt 5.15.5! --sean