QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
DiagramSortKeys Namespace Reference

Functions

QString coordinateKey (double v)
QString positionKey (const QPointF &pos)

Detailed Description

Sort-key helpers used by Diagram::toXml() to serialize elements and conductors in a deterministic order. Pulled into their own header (instead of an anonymous namespace in diagram.cpp) so they can be unit-tested directly – see tests/qttest/tst_diagramsortkeys.cpp.

Function Documentation

◆ coordinateKey()

QString DiagramSortKeys::coordinateKey ( double v)
inline

Format a coordinate as a string that sorts the same way the number does. Plain fixed-precision formatting ("%.4f") does NOT do this – e.g. "15.0000" sorts before "5.0000" as text even though 15 > 5 – so shift into a non-negative range and zero-pad to a fixed width before comparing.

Here is the caller graph for this function:

◆ positionKey()

QString DiagramSortKeys::positionKey ( const QPointF & pos)
inline
Here is the call graph for this function: