Changeset 269 in flair-src for trunk/tools/FlairGCS/src/Layout.cpp
- Timestamp:
- Oct 4, 2018, 1:53:11 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/FlairGCS/src/Layout.cpp
r244 r269 69 69 QGridLayout *Layout::getQGridLayout() { return qgridlayout; } 70 70 71 void Layout::XmlEvent(QDomElement dom) {71 void Layout::XmlEvent(QDomElement *dom) { 72 72 XmlWidget *widget = NULL; 73 QString type = dom .tagName();74 QString name = dom .attribute("name");75 QString old_name = dom .attribute("old_name");76 int row = dom .attribute("row").toInt();77 int col = dom .attribute("col").toInt();73 QString type = dom->tagName(); 74 QString name = dom->attribute("name"); 75 QString old_name = dom->attribute("old_name"); 76 int row = dom->attribute("row").toInt(); 77 int col = dom->attribute("col").toInt(); 78 78 79 79 // initially rowCount()=1 and columnCount()=1 but count()=0 ! … … 103 103 104 104 if (type == "TabWidget") { 105 int position = dom .attribute("position").toInt();105 int position = dom->attribute("position").toInt(); 106 106 widget = 107 107 new TabWidget(this, row, col, name, (QTabWidget::TabPosition)position); … … 114 114 } 115 115 if (type == "SpinBox") { 116 int value = dom .attribute("value").toInt();117 QString suffix = dom .attribute("suffix");118 int min = dom .attribute("min").toInt();119 int max = dom .attribute("max").toInt();120 int step = dom .attribute("step").toInt();116 int value = dom->attribute("value").toInt(); 117 QString suffix = dom->attribute("suffix"); 118 int min = dom->attribute("min").toInt(); 119 int max = dom->attribute("max").toInt(); 120 int step = dom->attribute("step").toInt(); 121 121 widget = new SpinBox(this, row, col, name, suffix, value, min, max, step); 122 122 } 123 123 if (type == "DoubleSpinBox") { 124 QString value = dom .attribute("value");125 QString suffix = dom .attribute("suffix");126 double min = dom .attribute("min").toDouble();127 double max = dom .attribute("max").toDouble();128 double step = dom .attribute("step").toDouble();129 int decimals = dom .attribute("decimals").toInt();124 QString value = dom->attribute("value"); 125 QString suffix = dom->attribute("suffix"); 126 double min = dom->attribute("min").toDouble(); 127 double max = dom->attribute("max").toDouble(); 128 double step = dom->attribute("step").toDouble(); 129 int decimals = dom->attribute("decimals").toInt(); 130 130 widget = new DoubleSpinBox(this, row, col, name, suffix, value, min, max, 131 131 step, decimals); … … 133 133 if (type == "Vector3DSpinBox") { 134 134 QString value[3]; 135 value[0] = dom .attribute("value_x");136 value[1] = dom .attribute("value_y");137 value[2] = dom .attribute("value_z");138 double min = dom .attribute("min").toDouble();139 double max = dom .attribute("max").toDouble();140 double step = dom .attribute("step").toDouble();141 int decimals = dom .attribute("decimals").toInt();135 value[0] = dom->attribute("value_x"); 136 value[1] = dom->attribute("value_y"); 137 value[2] = dom->attribute("value_z"); 138 double min = dom->attribute("min").toDouble(); 139 double max = dom->attribute("max").toDouble(); 140 double step = dom->attribute("step").toDouble(); 141 int decimals = dom->attribute("decimals").toInt(); 142 142 widget = new Vector3DSpinBox(this, row, col, name, value, min, max, step, 143 143 decimals); 144 144 } 145 145 if (type == "CheckBox") { 146 int value = dom .attribute("value").toInt();146 int value = dom->attribute("value").toInt(); 147 147 widget = new CheckBox(this, row, col, name, value); 148 148 } 149 149 if (type == "ComboBox") { 150 int value = dom .attribute("value").toInt();150 int value = dom->attribute("value").toInt(); 151 151 widget = new ComboBox(this, row, col, name, value); 152 152 } … … 155 155 } 156 156 if (type == "DataPlot1D") { 157 float ymin = dom .attribute("min").toFloat();158 float ymax = dom .attribute("max").toFloat();159 int enabled = dom .attribute("enabled").toInt();160 int period = dom .attribute("period").toInt();157 float ymin = dom->attribute("min").toFloat(); 158 float ymax = dom->attribute("max").toFloat(); 159 int enabled = dom->attribute("enabled").toInt(); 160 int period = dom->attribute("period").toInt(); 161 161 if (enabled == 1) { 162 162 widget = new DataPlot1D(this, row, col, name, ymin, ymax, true, period); … … 166 166 } 167 167 if (type == "DataPlot2D") { 168 float xmin = dom .attribute("xmin").toFloat();169 float xmax = dom .attribute("xmax").toFloat();170 float ymin = dom .attribute("ymin").toFloat();171 float ymax = dom .attribute("ymax").toFloat();172 QString x_name = dom .attribute("x_name");173 QString y_name = dom .attribute("y_name");174 int enabled = dom .attribute("enabled").toInt();175 int period = dom .attribute("period").toInt();168 float xmin = dom->attribute("xmin").toFloat(); 169 float xmax = dom->attribute("xmax").toFloat(); 170 float ymin = dom->attribute("ymin").toFloat(); 171 float ymax = dom->attribute("ymax").toFloat(); 172 QString x_name = dom->attribute("x_name"); 173 QString y_name = dom->attribute("y_name"); 174 int enabled = dom->attribute("enabled").toInt(); 175 int period = dom->attribute("period").toInt(); 176 176 if (enabled == 1) { 177 177 widget = new DataPlot2D(this, row, col, name, x_name, y_name, xmin, xmax, … … 183 183 } 184 184 if (type == "UsSensorPlot") { 185 float ymin = dom .attribute("ymin").toFloat();186 float ymax = dom .attribute("ymax").toFloat();187 QString y_name = dom .attribute("y_name");188 int enabled = dom .attribute("enabled").toInt();189 int period = dom .attribute("period").toInt();190 QString type = dom .attribute("type");191 int samples = dom .attribute("samples").toInt();185 float ymin = dom->attribute("ymin").toFloat(); 186 float ymax = dom->attribute("ymax").toFloat(); 187 QString y_name = dom->attribute("y_name"); 188 int enabled = dom->attribute("enabled").toInt(); 189 int period = dom->attribute("period").toInt(); 190 QString type = dom->attribute("type"); 191 int samples = dom->attribute("samples").toInt(); 192 192 if (enabled == 1) { 193 193 widget = new UsSensorPlot(this, row, col, name, y_name, … … 199 199 } 200 200 if (type == "RangeFinderPlot") { 201 float xmin = dom .attribute("xmin").toFloat();202 float xmax = dom .attribute("xmax").toFloat();203 float ymin = dom .attribute("ymin").toFloat();204 float ymax = dom .attribute("ymax").toFloat();205 QString x_name = dom .attribute("x_name");206 QString y_name = dom .attribute("y_name");207 QString data_type = dom .attribute("type");208 float start_angle = dom .attribute("start_angle").toFloat();209 float end_angle = dom .attribute("end_angle").toFloat();210 uint32_t nb_samples = dom .attribute("nb_samples").toUInt();211 int enabled = dom .attribute("enabled").toInt();212 int period = dom .attribute("period").toInt();213 int invert_axis = dom .attribute("invert_axis").toInt();201 float xmin = dom->attribute("xmin").toFloat(); 202 float xmax = dom->attribute("xmax").toFloat(); 203 float ymin = dom->attribute("ymin").toFloat(); 204 float ymax = dom->attribute("ymax").toFloat(); 205 QString x_name = dom->attribute("x_name"); 206 QString y_name = dom->attribute("y_name"); 207 QString data_type = dom->attribute("type"); 208 float start_angle = dom->attribute("start_angle").toFloat(); 209 float end_angle = dom->attribute("end_angle").toFloat(); 210 uint32_t nb_samples = dom->attribute("nb_samples").toUInt(); 211 int enabled = dom->attribute("enabled").toInt(); 212 int period = dom->attribute("period").toInt(); 213 int invert_axis = dom->attribute("invert_axis").toInt(); 214 214 bool invert_axis_bool; 215 215 if (invert_axis == 0) { … … 231 231 } 232 232 if (type == "Picture") { 233 int width = dom .attribute("width").toInt();234 int height = dom .attribute("height").toInt();235 int enabled = dom .attribute("enabled").toInt();236 int period = dom .attribute("period").toInt();233 int width = dom->attribute("width").toInt(); 234 int height = dom->attribute("height").toInt(); 235 int enabled = dom->attribute("enabled").toInt(); 236 int period = dom->attribute("period").toInt(); 237 237 if (enabled == 1) { 238 238 widget = new Picture(this, row, col, name, width, height, true, period); … … 242 242 } 243 243 if (type == "Map") { 244 int period = dom .attribute("period").toInt();245 int enabled = dom .attribute("enabled").toInt();244 int period = dom->attribute("period").toInt(); 245 int enabled = dom->attribute("enabled").toInt(); 246 246 int i = 0; 247 247 QList<QtMobility::QGeoCoordinate> coordinates; 248 while (dom .hasAttribute("lat" + QString::number(i))) {249 double latitude = dom .attribute("lat" + QString::number(i)).toDouble();250 double longitude = dom .attribute("long" + QString::number(i)).toDouble();251 double alt = dom .attribute("alt" + QString::number(i)).toDouble();248 while (dom->hasAttribute("lat" + QString::number(i))) { 249 double latitude = dom->attribute("lat" + QString::number(i)).toDouble(); 250 double longitude = dom->attribute("long" + QString::number(i)).toDouble(); 251 double alt = dom->attribute("alt" + QString::number(i)).toDouble(); 252 252 QtMobility::QGeoCoordinate coordinate = 253 253 QtMobility::QGeoCoordinate(latitude, longitude, alt); … … 272 272 QStringList items; 273 273 int count = 0; 274 while (dom .hasAttribute("item" + QString::number(count))) {275 QString item = dom .attribute("item" + QString::number(count));274 while (dom->hasAttribute("item" + QString::number(count))) { 275 QString item = dom->attribute("item" + QString::number(count)); 276 276 items.append(item); 277 277 count++;
Note:
See TracChangeset
for help on using the changeset viewer.