With the foundation of the previous 10 sections, and the simple QT debug window class I posted on my blog, there are two classes, one with singletons and one without. If you want to use it, you just add a header file and you can call it.

We now need to display the saved content to see if it is correctly read (although I think it is).

Go back to the old Nodets class and add the following public code:

`double returnNormalizedIntensity() { return NormalizedIntensity; } double returnOpacity() { return Opacity; } inline QColor& returnEmission() { return Emission; } `Copy the code

After all, members used to be private; now we need an interface that can access them. Next add a new member function to tsfunItem:

`inline int returnNumOfNodes(void) { return numOfNodes; } inline double returnDensityScale(void) { return DensityScale; } inline double returnShadingType(void) { return ShadingType; } inline double returnGradientFactor(void) { return GradientFactor; } inline NodeTsList& returnTsNodes(void){ return TsNodes; } inline void setNameID(QString& nameid) { NameID = nameid; } inline QString& returnNameID(void){ return NameID; } `Copy the code

Then add and use this function inside the tsfunGroup class:

`void TsfunGroup::showXML() { DebugWidget::getDebugWidget()->addContents(""); DebugWidget::getDebugWidget()->addContents(""); TsfunItem temptsfitmlist; for (int i = 0; i<tsfitmlist.count(); i++) { temptsfitmlist = tsfitmlist[i]; DebugWidget::getDebugWidget()->addContents(temptsfitmlist.returnNameID()); DebugWidget::getDebugWidget()->addContents(QString::number(temptsfitmlist.returnDensityScale())); DebugWidget::getDebugWidget()->addContents(QString::number(temptsfitmlist.returnGradientFactor())); DebugWidget::getDebugWidget()->addContents(QString::number(temptsfitmlist.returnShadingType())); NodeTsList ssTsNodes = temptsfitmlist.returnTsNodes(); for (int j = 0; j<ssTsNodes.count(); j++) { QString qsrg = QString::number(ssTsNodes[j].returnEmission().red()) +" " + QString::number(ssTsNodes[j].returnEmission().green()) + " " + QString::number(ssTsNodes[j].returnEmission().blue()); DebugWidget::getDebugWidget()->addContents(qsrg); DebugWidget::getDebugWidget()->addContents(QString::number(ssTsNodes[j].returnNormalizedIntensity())); DebugWidget::getDebugWidget()->addContents(QString::number(ssTsNodes[j].returnOpacity())); `}}}Copy the code

Pay attention to the inside of the DebugWidget: : getDebugWidget () – > addContents (); Are statements used for debugging.

This program is actually very simple, is from the inside of the class to find subclasses, subclass members, and then display the value.

The following information is displayed:

'normalMode 100 3 2 00 00 00 00 00 00 0.23597 00 00 0 0.288538 0.0179028 00 00 0.288578 0.563502 00 0 0.35417 100 01 1 MaxMode 100 2 00 00 00 00 00 0 0.13597 00 00 0.188538 0.0279028 00 0 0.288578 0.363502 00 0 0.45417 100 0 1Copy the code

All the data came back normal.

We are now able to read the data from the XML file into the structure of our design and display it correctly. In the next section we’ll figure out how to design a way to output our structure to an XML file. Note that we are exporting the data inside the structure to an XML file, not the structure of the QDomdocument we read into.