Don't allow variable names equal to function or constant names
ClosedPublic

Authored by Murmele on Jun 23 2019, 10:22 AM.

Details

Summary

At the moment variable names used in the FunctionValuesDialog can be same than predefined function or constant names. This results in unexpected results in the column. To prevent this, it will be checked if the variable name is equal to the predefined names and the generation is blocked if they are equal. So the user has to change the variable name.

Diff Detail

Repository
R262 LabPlot
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Murmele created this revision.Jun 23 2019, 10:22 AM
Restricted Application added a project: KDE Edu. · View Herald TranscriptJun 23 2019, 10:22 AM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
Murmele requested review of this revision.Jun 23 2019, 10:22 AM
asemke added inline comments.Jun 23 2019, 11:40 AM
src/kdefrontend/spreadsheet/FunctionValuesDialog.cpp
163

why not to search with constants().indexOf(name) and comparing the found index with -1?

Murmele updated this revision to Diff 60464.Jun 23 2019, 11:54 AM
Murmele marked an inline comment as done.
asemke accepted this revision.Jun 23 2019, 11:59 AM
This revision is now accepted and ready to land.Jun 23 2019, 11:59 AM
This revision was automatically updated to reflect the committed changes.