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

Function readSourceTimelineViewState

pj_app/src/LayoutXml.cpp:227–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225}
226
227SourceTimelineViewState readSourceTimelineViewState(const QDomElement& element) {
228 SourceTimelineViewState state;
229 if (element.isNull()) {
230 return state;
231 }
232 bool ok = false;
233 if (element.hasAttribute(QStringLiteral("zoom"))) {
234 const double zoom = element.attribute(QStringLiteral("zoom")).toDouble(&ok);
235 if (ok && zoom > 0.0) {
236 state.zoom = zoom;
237 }
238 }
239 if (element.hasAttribute(QStringLiteral("scroll_left_ns"))) {
240 const qint64 left_ns = element.attribute(QStringLiteral("scroll_left_ns")).toLongLong(&ok);
241 if (ok) {
242 state.scroll_left_ns = left_ns;
243 }
244 }
245 if (element.hasAttribute(QStringLiteral("name_column_width"))) {
246 const int width = element.attribute(QStringLiteral("name_column_width")).toInt(&ok);
247 if (ok && width > 0) {
248 state.name_column_width = width;
249 }
250 }
251 if (element.hasAttribute(QStringLiteral("snap"))) {
252 state.snap = element.attribute(QStringLiteral("snap")) == QStringLiteral("true");
253 }
254 return state;
255}
256
257bool isSamePath(const QString& a, const QString& b) {
258 if (a.isEmpty() || b.isEmpty()) {

Callers 3

roundTripViewStateFunction · 0.85
TESTFunction · 0.85

Calls 3

toDoubleMethod · 0.80
toIntMethod · 0.80
isNullMethod · 0.45

Tested by 2

roundTripViewStateFunction · 0.68
TESTFunction · 0.68