28 QString removeLeadingSlash(
const QString&
name)
39 if (container->
modelType() !=
"Parameter Container")
40 throw GUIHelpers::Error(
"ParameterTreeUtils::populateParameterContainer() -> Error. "
41 "Not a ParameterContainerType.");
71 populateDomainLinks(container);
81 if (container->
modelType() !=
"Parameter Container")
82 throw GUIHelpers::Error(
"ParameterTreeUtils::populateParameterContainer() -> Error. "
83 "Not a ParameterContainerType.");
86 handleItem(sourceLabel, source);
95 QStack<SessionItem*> stack;
97 while (!stack.empty()) {
98 current = stack.pop();
99 if (current->
modelType() ==
"Parameter Label"
100 || current->
modelType() ==
"Parameter Container") {
117 result << pair.first;
129 result << pair.second;
141 QVector<QPair<QString, QString>> result;
158 result.push_back(QPair<QString, QString>(parPath, translation));
160 std::reverse(result.begin(), result.end());
171 QString domain = removeLeadingSlash(domainName);
173 if (pair.second == domain)
187 if (pair.first == parName)
188 return "/" + pair.second;
207 if (parPath == parName) {
221 if (tree->
modelType() ==
"Parameter Label") {
226 else if (tree->
modelType() ==
"Parameter") {
229 double sourceValue = source->
value().toDouble();
230 tree->
setValue(QVariant(sourceValue));
232 int firstSlash = path.indexOf(
'/');
233 path = path.mid(firstSlash + 1);
244 if (child->isVisible() && child->isEnabled()) {
245 if (child->modelType() ==
"Property") {
246 if (child->value().type() == QVariant::Double) {
248 handleItem(branch, child);
251 }
else if (child->modelType() ==
"GroupProperty") {
255 handleItem(branch, currentItem);
259 handleItem(branch, child);
#define ASSERT(condition)
Defines class FitParameterHelper.
Defines class GUIHelpers functions.
Defines ModelPath namespace.
Defines class MultiLayerItem.
Defines classes for ParameterTreeItems.
Defines ParameterTreeUtils namespace.
Defines class SampleModel.
static QString getParameterItemPath(const ParameterItem *parameterItem)
return path to given item in the ParameterTreeContainer
static const QString T_SAMPLE
static const QString T_PARAMETER_TREE
static const QString T_INSTRUMENT
static const QString T_MATERIAL_CONTAINER
The ParameterContainerItem is a top item to hold all ParameterItem, represents an entry point to para...
The ParameterItem class represent a tuning value in a parameter tuning tree.
SessionItem * linkedItem()
Returns corresponding linked item in MultiLayerItem/IsntrumentItem.
static const QString P_DOMAIN
static const QString P_LINK
static const QString P_BACKUP
ParameterTreeItems is a collection of items necessary to form a tuning tree for real time widget.
Main model to hold sample items.
QString itemName() const
Get item name, return display name if no name is set.
QVector< SessionItem * > getItems(const QString &tag="") const
Returns vector of all items of given tag.
int numberOfChildren() const
Returns total number of children.
QString displayName() const
Get display name of item, append index if ambigue.
QVariant value() const
Get value.
bool setValue(QVariant value)
Set value, ensure that variant types match.
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
void setDisplayName(const QString &display_name)
Set display name.
SessionItem * parent() const
Returns parent of this item.
SessionModel * model() const
Returns model of this item.
void setItemValue(const QString &tag, const QVariant &variant)
Directly set value of item under given tag.
QVector< SessionItem * > children() const
Returns vector of all children.
QString modelType() const
Get model type.
QModelIndex index() const
Returns model index of this item.
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.
T * insertItem(SessionItem *parent=nullptr, int row=-1, QString tag="")
SessionItem * getItemFromPath(const QString &relPath, const SessionItem *parent)
returns an item from relative path wrt to given parent
QString getPathFromIndex(const QModelIndex &index)
QString itemPathTranslation(const SessionItem &item, const SessionItem *topItem=0)
Returns translation of item path to domain name.
void visitParameterContainer(SessionItem *container, std::function< void(ParameterItem *)> fun)
Visit all ParameterItem in container and execute user function.
QStringList translatedParameterTreeNames(const SessionItem *source)
Creates domain translated list of parameter names for source item.
QString domainNameToParameterName(const QString &domainName, const SessionItem *source)
Converts domain name to parameterItem name.
QStringList parameterTreeNames(const SessionItem *source)
Creates list with parameter names of source item.
QVector< QPair< QString, QString > > parameterDictionary(const SessionItem *source)
Correspondance of parameter name to translated name for all properties found in source in its childre...
QString parameterNameToDomainName(const QString &parName, const SessionItem *source)
Converts parameter name to domain name.
void populateParameterContainer(SessionItem *container, const SessionItem *source)
Populates ParameterContainer with ParameterItem's corresponding to all properties found in a source i...
void createParameterTree(JobItem *jobItem)
SessionItem * parameterNameToLinkedItem(const QString &parName, const SessionItem *source)
Converts parameter item name to the corresponding item in the tree below the source.
QString const & name(EShape k)