MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / SetJsonValue

Method SetJsonValue

src/QtTextReader.cpp:238–271  ·  view source on GitHub ↗

Load Json::Value into this object

Source from the content-addressed store, hash-verified

236
237// Load Json::Value into this object
238void QtTextReader::SetJsonValue(const Json::Value root) {
239
240 // Set parent data
241 ReaderBase::SetJsonValue(root);
242
243 // Set data from Json (if key is found)
244 if (!root["width"].isNull())
245 width = root["width"].asInt();
246 if (!root["height"].isNull())
247 height = root["height"].asInt();
248 if (!root["x_offset"].isNull())
249 x_offset = root["x_offset"].asInt();
250 if (!root["y_offset"].isNull())
251 y_offset = root["y_offset"].asInt();
252 if (!root["text"].isNull())
253 text = root["text"].asString();
254 if (!root["font"].isNull())
255 font.fromString(QString::fromStdString(root["font"].asString()));
256 if (!root["text_color"].isNull())
257 text_color = root["text_color"].asString();
258 if (!root["background_color"].isNull())
259 background_color = root["background_color"].asString();
260 if (!root["text_background_color"].isNull())
261 text_background_color = root["text_background_color"].asString();
262 if (!root["gravity"].isNull())
263 gravity = (GravityType) root["gravity"].asInt();
264
265 // Re-Open path, and re-init everything (if needed)
266 if (is_open)
267 {
268 Close();
269 Open();
270 }
271}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected