FS#2671 - RColor > Automatically remove leading/trailing whitespace from custom colors name and color code
Andrew,
Initial tests for this reply on the forum failed because of a space.
I tend to add a space after a comma by habit.
For QCAD Pro RColor::init() additionally loads the user palette.
A list of colorstrings separated by an EOL and split up per line.
An empty colorstring is skipped (e.g. first of every imported palette)
Each of the colorstrings is split into tuples at a comma.
Not at least 2 tuples adds a separator line.
The last tuple is considered as a color code.
This is not validated as in range ‘#000000’-’#ffffff’, starting with ‘#’ + 6 characters ‘0-f’.
Anything before the last comma is considered as the custom name or ‘title’.
This may be empty, include leading/trailing whitespace and/or include a comma.
Before the first custom entry it adds a separator line.
A color code starting with a space would be invalid.
Trailing spaces are not distinguishable in the preference page and also invalid.
It would already be neater to init a custom color from the list with:
init(title.trimmed(), RColor(code.trimmed()));
Presuming that .trimmed() is the cpp analog for String.prototype.trim in JS.
Regards,
CVH
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task