MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / writeSourceTimelineViewState

Function writeSourceTimelineViewState

pj_app/src/LayoutXml.cpp:209–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209QDomElement writeSourceTimelineViewState(QDomDocument& doc, const SourceTimelineViewState& state) {
210 QDomElement element = doc.createElement(QStringLiteral("source_timeline"));
211 if (state.zoom) {
212 // High-precision 'g' so the tiny pixels-per-ns zoom (~1e-7) round-trips exactly.
213 element.setAttribute(QStringLiteral("zoom"), QString::number(*state.zoom, 'g', 17));
214 }
215 if (state.scroll_left_ns) {
216 element.setAttribute(QStringLiteral("scroll_left_ns"), QString::number(*state.scroll_left_ns));
217 }
218 if (state.name_column_width) {
219 element.setAttribute(QStringLiteral("name_column_width"), QString::number(*state.name_column_width));
220 }
221 if (state.snap) {
222 element.setAttribute(QStringLiteral("snap"), *state.snap ? QStringLiteral("true") : QStringLiteral("false"));
223 }
224 return element;
225}
226
227SourceTimelineViewState readSourceTimelineViewState(const QDomElement& element) {
228 SourceTimelineViewState state;

Callers 3

roundTripViewStateFunction · 0.85
TESTFunction · 0.85

Calls 1

setAttributeMethod · 0.45

Tested by 2

roundTripViewStateFunction · 0.68
TESTFunction · 0.68