SUMMARY clazy-empty-qstringliteral is great, but it produces too many warnings for uic generated files. STEPS TO REPRODUCE 1. Create ".ui" file 2. Change stylesheet to something, and then clear it. 3. You will get in generated by uic c++ code, something like: ActionConfirmContextMenu->setStyleSheet(QStringLiteral("")); OBSERVED RESULT EXPECTED RESULT It would be great if clazy automatically disable `clazy-empty-qstringliteral` for headers file that starts with "ui_" and ends with ".h" SOFTWARE VERSIONS (available in About System) Qt Version: 5.11.2 ADDITIONAL INFORMATION
Does it happen only for stylesheets ?
Probably any property. Deserves to be fixed in Qt first though.
Git commit 6e5fee3730ad2e443d9ec93eb88f06ee7f8b33e2 by Sergio Martins. Committed on 09/10/2018 at 10:37. Pushed by smartins into branch '1.4'. empty-qstringliteral: Don't warn for uic generated files Since 5.12 this is no longer an issue, since QStringLiteral was abolished from ui_*.h files. M +17 -0 src/checks/level0/empty-qstringliteral.cpp M +1 -0 src/checks/level0/empty-qstringliteral.h M +1 -1 tests/empty-qstringliteral/main.cpp A +50 -0 tests/empty-qstringliteral/ui_qstringliteral.h [License: GENERATED FILE] * The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page. https://commits.kde.org/clazy/6e5fee3730ad2e443d9ec93eb88f06ee7f8b33e2
Thank you.
The problem is still here, I suppose this is because of: + // Since 5.12 uic no longer uses QStringLiteral("") + if (preProcessorVisitor && preProcessorVisitor->qtVersion() >= 051200) + return false; In my case preProcessorVisitor->qtVersion() return 51102, but this is in decimal representation, in octet representation it is 0143636, and os it it bigger then 051200. I suppose the right fix will be 51200, without '0' prefix.
Git commit 2860f3dc6069b600383959563d5c5b475d523014 by Sergio Martins. Committed on 09/10/2018 at 12:20. Pushed by smartins into branch '1.4'. Fix unintended octal value M +1 -1 src/checks/level0/empty-qstringliteral.cpp https://commits.kde.org/clazy/2860f3dc6069b600383959563d5c5b475d523014
try now, it should be fixed (branch 1.4) thanks
Thank you, now after long period of time I have zero warnings in my projects.
Git commit 971c0cc4f3488c847746967450557c4fa390753b by Sergio Martins. Committed on 09/10/2018 at 12:19. Pushed by smartins into branch 'master'. Fix unintended octal value M +1 -1 src/checks/level0/empty-qstringliteral.cpp https://commits.kde.org/clazy/971c0cc4f3488c847746967450557c4fa390753b
> if (preProcessorVisitor && preProcessorVisitor->qtVersion() >= 51200) At now I updated my system Qt to 5.12 and: >ui_ValueCancelDialog.h:42:42: warning: Use QString instead of an empty QStringLiteral [-Wclazy-empty-qstringliteral] So may be change 51200 to something like 59999 ?
Sorry for noise, it was cache issue, after clean rebuild ui_ files were generated without empty QStringLiteral