Skip to content

Commit 2d769b3

Browse files
committed
Remove _MDSubItems member
1 parent a8751f8 commit 2d769b3

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

QMLComponents/analysisform.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -968,10 +968,7 @@ QString AnalysisForm::helpMD() const
968968
for(JASPControl * control : orderedControls)
969969
{
970970
if (control->hasInfoSomewhere())
971-
{
972-
control->setMDSubItems();
973971
markdown << control->generateMDHelp() << "\n";
974-
}
975972
}
976973

977974
markdown << metaHelpMD();

QMLComponents/controls/jaspcontrol.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -602,37 +602,40 @@ bool JASPControl::hasLabelOrInfo() const
602602
return !fullLabel().isEmpty() || !info().isEmpty();
603603
}
604604

605-
void JASPControl::setMDSubItems()
605+
std::vector<JASPControl*> JASPControl::getMDSubItems() const
606606
{
607-
_MDSubItems.clear();
607+
std::vector<JASPControl*> MDSubItems;
608608

609609
for (JASPControl* childControl : getChildJASPControls(_childControlsArea ? _childControlsArea : this, true))
610610
{
611611
// 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
612612
if (childControl->hasInfoSomewhere() || (controlType() == ControlType::RadioButtonGroup && childControl->controlType() == ControlType::RadioButton))
613613
{
614-
childControl->setMDSubItems();
614+
std::vector<JASPControl*> MDGrandChilren = childControl->getMDSubItems();
615615

616616
if (!childControl->hasLabelOrInfo())
617617
// 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());
619619
else
620-
_MDSubItems.push_back(childControl);
620+
MDSubItems.push_back(childControl);
621621
}
622622
}
623+
624+
return MDSubItems;
623625
}
624626

625627
QString JASPControl::generateMDHelp(int depth) const
626628
{
629+
std::vector<JASPControl*> MDSubItems = getMDSubItems();
627630
QStringList markdown;
628631
markdown << printLabelMD(depth) << info() << "\n";
629632

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)
633636
{
634637
markdown << "\n"; // Before adding bullets, a new line is needed
635-
for (const auto& childMD : _MDSubItems)
638+
for (const auto& childMD : MDSubItems)
636639
markdown << QString{depth * 2, ' '} << "- " << childMD->generateMDHelp(depth + 1);
637640
}
638641

QMLComponents/controls/jaspcontrol.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class JASPControl : public QQuickItem
119119
virtual bool infoLabelItalic() const { return false; }
120120

121121
QString toolTip() const { return _toolTip; }
122-
void setMDSubItems();
122+
std::vector<JASPControl*> getMDSubItems() const;
123123
virtual QString generateMDHelp(int depth = 0) const;
124124
virtual QString generateDoxygenHelp() const;
125125
virtual bool hasInfoSomewhere() const;
@@ -180,7 +180,6 @@ class JASPControl : public QQuickItem
180180

181181
virtual QString friendlyName() const;
182182
void addExplicitDependency();
183-
const std::vector<JASPControl*>& MDSubItems() const { return _MDSubItems; }
184183
bool hasLabelOrInfo() const;
185184

186185
public slots:
@@ -321,8 +320,6 @@ private slots:
321320
QVariant _explicitDepends;
322321
QString _info,
323322
_infoLabel;
324-
std::vector<JASPControl*> _MDSubItems;
325-
326323

327324
static QMap<QQmlEngine*, QQmlComponent*> _mouseAreaComponentMap;
328325
static QByteArray _mouseAreaDef;

0 commit comments

Comments
 (0)