Exemplo n.º 1
0
void TreeModel::redrawArray(const QModelIndex arrayIndex){
	if(Teuchos::toString(itemEntry(arrayIndex)->getAny()).size() <= 2){
		emit hideData(arrayIndex.row(), arrayIndex.parent());
	}
	else{
		setData(arrayIndex, QString::fromStdString(Teuchos::toString(itemEntry(arrayIndex)->getAny())));
		emit showData(arrayIndex.row(), arrayIndex.parent());
	}
}
Exemplo n.º 2
0
void TreeModel::dataChangedListener(const QModelIndex& index1, const QModelIndex& /*index2*/){
	const Teuchos::ParameterEntry* changedIndexEntry = itemEntry(index1);	
	QModelIndex dependee = index1.sibling(index1.row(), 0);
	if(dependencySheet->hasDependents(changedIndexEntry)){
		DependencySheet::DepSet deps =  dependencySheet->getDependenciesForParameter(changedIndexEntry);
		for(DependencySheet::DepSet::iterator it = deps.begin(); it != deps.end(); ++it){
			(*it)->evaluate();
			checkDependentState(dependee,*it);
		}
	}
}
Exemplo n.º 3
0
QModelIndex TreeModel::findParameterEntryIndex(const Teuchos::ParameterEntry *parameterEntry, const std::string parameterName){
	QString targetName = QString::fromStdString(parameterName);
	QList<QModelIndex> potentialMatches = match(index(0,0), Qt::DisplayRole, QString::fromStdString(parameterName),
				        	    -1, Qt::MatchExactly | Qt::MatchRecursive );
	for(QList<QModelIndex>::const_iterator it = potentialMatches.begin(); it != potentialMatches.end(); ++it){
		if(parameterEntry == itemEntry(*it)){
			return *it;
		}
	}
	return QModelIndex();
}
Exemplo n.º 4
0
Json::Value Inventory::serialize() const
{
   Json::Value inventoryNode(Json::arrayValue);
   for(const auto& iter : m_items)
   {
      int itemNumber = iter.first;
      int itemQuantity = iter.second;

      if(itemQuantity > 0)
      {
         Json::Value itemEntry(Json::objectValue);
         itemEntry[Inventory::ITEM_NUM_ATTRIBUTE] = itemNumber;
         itemEntry[Inventory::ITEM_QUANTITY_ATTRIBUTE] = itemQuantity;

         inventoryNode.append(itemEntry);
      }
   }

   return inventoryNode;
}
Exemplo n.º 5
0
Teuchos::RCP<const Teuchos::ParameterEntryValidator> TreeModel::getValidator(const QModelIndex &index) const{
	return itemEntry(index)->validator();
}