Commit 7cb44e85 authored by ZUBIAGA Carlos J.'s avatar ZUBIAGA Carlos J.
Browse files

Expose parameter menu bar widgets

parent 8006e89f
Pipeline #141030 passed with stage
in 0 seconds
......@@ -43,6 +43,7 @@ public:
public:
dtkCoreParameters parameters;
QHash<QString, dtkWidgetsParameter *> parameters_items;
};
// ///////////////////////////////////////////////////////////////////
......@@ -89,6 +90,7 @@ void dtkWidgetsParameterMenuBarGeneratorPrivate::parseParameter(dtkWidgetsMenu *
dtkCoreParameter *parameter = this->parameters[parameter_uid];
if (!parameter) {
qWarning() << Q_FUNC_INFO << "The parameter with uid :" << parameter_uid << "is nullptr";
return;
}
dtkWidgetsMenuItem *parameter_item = nullptr;
......@@ -100,11 +102,12 @@ void dtkWidgetsParameterMenuBarGeneratorPrivate::parseParameter(dtkWidgetsMenu *
}
if(parameter_item) {
auto&& param_widget = static_cast<dtkWidgetsMenuItemParameter *>(parameter_item)->widget();
auto param_widget = dynamic_cast<dtkWidgetsMenuItemParameter *>(parameter_item)->widget();
param_widget->setAdvanced(parameter_object["advanced"].toBool());
if(parameter_object.contains("widget_read_only")) {
param_widget->setReadOnly(parameter_object["widget_read_only"].toBool());
}
parameters_items[parameter_uid] = param_widget;
}
}
......@@ -235,5 +238,10 @@ dtkCoreParameters dtkWidgetsParameterMenuBarGenerator::parameters(void) const
return d->parameters;
}
QHash<QString, dtkWidgetsParameter *> dtkWidgetsParameterMenuBarGenerator::parametersWidgets(void) const
{
return d->parameters_items;
}
//
// dtkWidgetsParameterMenuBarGenerator.cpp ends here
......@@ -23,6 +23,9 @@
class dtkWidgetsMenu;
class dtkWidgetsMenuBar;
class dtkWidgetsMenuBarContainer;
class dtkWidgetsParameter;
class dtkCoreParameter;
// ///////////////////////////////////////////////////////////////////
......@@ -44,6 +47,8 @@ public:
public:
dtkCoreParameters parameters(void) const;
QHash<QString, dtkWidgetsParameter *> parametersWidgets(void) const;
protected:
class dtkWidgetsParameterMenuBarGeneratorPrivate *d;
};
......
Markdown is supported
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