WSL/SLF GitLab Repository

Commit 697b3315 authored by Michael Reisecker's avatar Michael Reisecker
Browse files

The Spacer options were completely messed up...

Height and width set in XML have just been ignored (they were expected
as option nodes, not attributes).
This has been fixed. Please revisit your spacer sizes...
parent c4b77ff9
......@@ -38,7 +38,7 @@ https://models.slf.ch/p/alpine3d
<!-- GENERAL -->
<include file="meteoio_general.xml"/>
<parameter type="spacer" height="500"/>
<parameter type="spacer" height="40"/>
<parameter type="label" label="&lt;h3&gt;Application information&lt;/h3&gt;" color="sl_blue"/>
<reference name="INFO_METEOIO"/>
<reference name="INFO_SNOWPACK"/>
......@@ -143,7 +143,7 @@ https://models.slf.ch/p/alpine3d
<section name="Filters"/>
<reference name="FILTERS"/>
</frame>
<parameter type="spacer" height="500" section="Filters"/>
<parameter type="spacer" height="50" section="Filters"/>
<frame caption="Time filters">
<section name="Filters"/>
<reference name="TIMEFILTERS"/>
......
......@@ -29,7 +29,7 @@ https://models.slf.ch/p/snowpack
<parameter type="helptext" wrap="true" section="EBalance">
<help>First, the measured radiation (as provided by each station that measured both ISWR, TA and RH) is interpolated over the domain (see the &lt;a href="https://models.slf.ch/docserver/alpine3d/html/radiation_balance.html"&gt;online documentation&lt;/a&gt;). Then the effects of the terrain on the radiation field are accounted for. These are twofold: first the topography can cast shade on some parts of the domain (this is always computed) and second some radiation can be reflected by the terrain on some other cells (this is what is configured here).</help>
</parameter>
<parameter type="spacer" height="60" section="EBalance"/>
<parameter type="spacer" height="10" section="EBalance"/>
<parameter key="Terrain_Radiation" type="alternative" default="TRUE" section="EBalance">
<option value="TRUE">
......
......@@ -80,7 +80,7 @@ https://models.slf.ch/p/alpine3d
<parameter key="PRIO#::gun_operation" type="number" format="decimal" precision="2" default="1.00" unit="" optional="false">
<help>Fraction of snow gun operation [0-1]</help>
</parameter>
<parameter type="spacer" height="60" section="TechSnow"/>
<parameter type="spacer" height="10" section="TechSnow"/>
<!--</frame>-->
</parametergroup>
......
......@@ -28,7 +28,7 @@ https://models.slf.ch/p/meteoio
<!-- GENERAL -->
<include file="meteoio_general.xml"/>
<parameter type="spacer" height="500"/>
<parameter type="spacer" height="40"/>
<parameter type="label" label="&lt;h3&gt;Application information&lt;/h3&gt;" color="sl_blue"/>
<reference name="INFO_METEOIO"/>
<include file="workflow_meteoio.xml"/>
......@@ -98,7 +98,7 @@ https://models.slf.ch/p/meteoio
<section name="Filters"/>
<reference name="FILTERS"/>
</frame>
<parameter type="spacer" height="500" section="Filters"/>
<parameter type="spacer" height="50" section="Filters"/>
<frame caption="Time filters">
<section name="Filters"/>
<reference name="TIMEFILTERS"/>
......
......@@ -28,7 +28,7 @@ https://models.slf.ch/p/snowpack
<!-- GENERAL -->
<include file="meteoio_general.xml"/>
<parameter type="spacer" height="500"/>
<parameter type="spacer" height="40"/>
<parameter type="label" label="&lt;h3&gt;Application information&lt;/h3&gt;" color="sl_blue"/>
<reference name="INFO_METEOIO"/>
<reference name="INFO_SNOWPACK"/>
......@@ -107,7 +107,7 @@ https://models.slf.ch/p/snowpack
<section name="Filters"/>
<reference name="FILTERS"/>
</frame>
<parameter type="spacer" height="500" section="Filters"/>
<parameter type="spacer" height="50" section="Filters"/>
<frame caption="Time filters">
<section name="Filters"/>
<reference name="TIMEFILTERS"/>
......
......@@ -32,7 +32,7 @@ https://models.slf.ch/p/snowpack
<parameter type="helptext" wrap="true" section="SnowpackAdvanced">
<help>&lt;font color="#ff0000"&gt;&lt;strong&gt;The keys in this section deeply affect the operation of the SNOWPACK model. This could lead to unexpected behavior or surprising results. If you are not an experienced Snowpack user, please do NOT change any keys below!&lt;/strong&gt;&lt;/font&gt;</help>
</parameter>
<parameter type="spacer" height="60" section="SnowpackAdvanced"/>
<parameter type="spacer" height="10" section="SnowpackAdvanced"/>
<frame caption="Operation mode" section="SnowpackAdvanced">
<parameter key="VARIANT" type="alternative" default="DEFAULT" section="SnowpackAdvanced">
......
......@@ -21,6 +21,10 @@
#include "src/main/constants.h"
#include "src/main/inishell.h"
//#ifdef DEBUG
#include <iostream>
//#endif //def DEBUG
/**
* @brief Default constructor for a Spacer.
* @details A QSpacerItem needs separate handling everywhere (it's not a QWidget), which is why
......@@ -35,18 +39,19 @@ Spacer::Spacer(const QDomNode &options, QWidget *parent) : QWidget(parent)
bool success = true;
const QDomElement op_el( options.toElement() );
/* look for "height" or "h" */
if (!op_el.firstChildElement("height").isNull())
height = op_el.firstChildElement("height").text().toInt(&success);
if (!success && !op_el.firstChildElement("h").isNull())
height = op_el.firstChildElement("h").text().toInt(&success);
if (!op_el.attribute("height").isNull())
height = op_el.attribute("height").toInt(&success);
if (!success && !op_el.attribute("h").isNull())
height = op_el.attribute("h").toInt(&success);
if (!success)
topLog(tr(R"(XML error: Could not parse height "%1" for spacer element)"), "error");
topLog(tr(R"(XML error: Could not parse height for spacer element)"), "error");
/* look for "width" or "w" */
if (!op_el.firstChildElement("width").isNull())
width = op_el.firstChildElement("width").text().toInt(&success);
if (!success && !op_el.firstChildElement("w").isNull())
height = op_el.firstChildElement("w").text().toInt(&success);
success = true;
if (!op_el.attribute("width").isNull())
width = op_el.attribute("width").toInt(&success);
if (!success && !op_el.attribute("w").isNull())
width = op_el.attribute("w").toInt(&success);
if (!success)
topLog(tr(R"(XML error: Could not parse width "%1" for spacer element)"), "error");
topLog(tr(R"(XML error: Could not parse width for spacer element)"), "error");
this->setFixedSize(width, height);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment