@@ -602,37 +602,40 @@ bool JASPControl::hasLabelOrInfo() const
602
602
return !fullLabel ().isEmpty () || !info ().isEmpty ();
603
603
}
604
604
605
- void JASPControl::setMDSubItems ()
605
+ std::vector<JASPControl*> JASPControl::getMDSubItems () const
606
606
{
607
- _MDSubItems. clear () ;
607
+ std::vector<JASPControl*> MDSubItems ;
608
608
609
609
for (JASPControl* childControl : getChildJASPControls (_childControlsArea ? _childControlsArea : this , true ))
610
610
{
611
611
// In case of RadioButtonGroup, if at least one of the RadioButton has info, then all RadioButtons should be listed even if they don't have any info
612
612
if (childControl->hasInfoSomewhere () || (controlType () == ControlType::RadioButtonGroup && childControl->controlType () == ControlType::RadioButton))
613
613
{
614
- childControl->setMDSubItems ();
614
+ std::vector<JASPControl*> MDGrandChilren = childControl->getMDSubItems ();
615
615
616
616
if (!childControl->hasLabelOrInfo ())
617
617
// The child does not have label nor info: just add its own children to the parent
618
- _MDSubItems .insert (_MDSubItems .end (), childControl-> MDSubItems () .begin (), childControl-> MDSubItems () .end ());
618
+ MDSubItems .insert (MDSubItems .end (), MDGrandChilren .begin (), MDGrandChilren .end ());
619
619
else
620
- _MDSubItems .push_back (childControl);
620
+ MDSubItems .push_back (childControl);
621
621
}
622
622
}
623
+
624
+ return MDSubItems;
623
625
}
624
626
625
627
QString JASPControl::generateMDHelp (int depth) const
626
628
{
629
+ std::vector<JASPControl*> MDSubItems = getMDSubItems ();
627
630
QStringList markdown;
628
631
markdown << printLabelMD (depth) << info () << " \n " ;
629
632
630
- if (_MDSubItems .size () == 1 )
631
- markdown << " \n " << QString{depth * 2 , ' ' } << _MDSubItems [0 ]->generateMDHelp (depth + 1 );
632
- else if (_MDSubItems .size () > 1 )
633
+ if (MDSubItems .size () == 1 )
634
+ markdown << " \n " << QString{depth * 2 , ' ' } << MDSubItems [0 ]->generateMDHelp (depth + 1 );
635
+ else if (MDSubItems .size () > 1 )
633
636
{
634
637
markdown << " \n " ; // Before adding bullets, a new line is needed
635
- for (const auto & childMD : _MDSubItems )
638
+ for (const auto & childMD : MDSubItems )
636
639
markdown << QString{depth * 2 , ' ' } << " - " << childMD->generateMDHelp (depth + 1 );
637
640
}
638
641
0 commit comments