QCAD Bugtracker

  • Status Assigned
  • Percent Complete
    0%
  • Task Type Suggestion
  • Category QCAD (main)
  • Assigned To
    andrew
  • Operating System All
  • Severity Very Low
  • Priority Very Low
  • Reported Version n/a
  • Due in Version Undecided
  • Due Date Undecided
  • Votes 1
    • CVH (19.05.2025)
  • Private
Attached to Project: QCAD Bugtracker
Opened by CVH - 19.05.2025
Last edited by CVH - 21.05.2025

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

Tasklist

Task Details

Task Editing