Beispiel #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool PdmUiLineEditor::isMultipleFieldsWithSameKeywordSelected(PdmFieldHandle* editorField) const
{
    std::vector<PdmFieldHandle*> fieldsToUpdate;
    fieldsToUpdate.push_back(editorField);

    // For current selection, find all fields with same keyword
    std::vector<PdmUiItem*> items;
    SelectionManager::instance()->selectedItems(items, SelectionManager::FIRST_LEVEL);

    for (size_t i = 0; i < items.size(); i++)
    {
        PdmUiFieldHandle* uiField = dynamic_cast<PdmUiFieldHandle*>(items[i]);
        if (!uiField) continue;

        PdmFieldHandle* field = uiField->fieldHandle();
        if (field && field != editorField && field->keyword() == editorField->keyword())
        {
            fieldsToUpdate.push_back(field);
        }
    }

    if (fieldsToUpdate.size() > 1)
    {
        return true;
    }

    return false;
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
PdmUiFieldEditorHandle* PdmUiTableViewModel::getEditor(const QModelIndex &index)
{
    PdmFieldHandle* field = getField(index);
    if (!field)
    {
        return NULL;
    }

    PdmUiFieldEditorHandle* editor = NULL;
    
    std::map<QString, PdmUiFieldEditorHandle*>::iterator it;
    it = m_fieldEditors.find(field->keyword());

    if (it != m_fieldEditors.end())
    {
        editor = it->second;
        if (editor)
        {
            if (field)
            {
                editor->setField(field->uiCapability());
            }
        }
    }
    
    return editor;
}
Beispiel #3
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
PdmFieldHandle*  PdmObject::findField(const QString& keyword)
{
    std::vector<PdmFieldHandle*>::iterator it;
    for (it = m_fields.begin(); it != m_fields.end(); it++)
    {
        PdmFieldHandle* obj = *it;
        if (obj->keyword() == keyword)
        {
            return obj;
        }
    }

    return NULL;
}
Beispiel #4
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
PdmFieldHandle* PdmObjectHandle::findField(const QString& keyword) const
{
    std::vector<PdmFieldHandle*> fields;
    this->fields(fields);

    for (size_t it = 0; it < fields.size(); it++)
    {
        PdmFieldHandle* field = fields[it];
        if (field->keyword() == keyword)
        {
            return field;
        }
    }

    return nullptr;
}
Beispiel #5
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void PdmObject::writeFields(QXmlStreamWriter& xmlStream)
{
    std::vector<PdmFieldHandle*>::iterator it;
    for (it = m_fields.begin(); it != m_fields.end(); ++it)
    {
        PdmFieldHandle* field = *it;
        if (field->isIOWritable())
        {
            QString keyword = field->keyword();
            assert(PdmObject::isValidXmlElementName(keyword));

            xmlStream.writeStartElement("", keyword);
            field->writeFieldData(xmlStream);
            xmlStream.writeEndElement();
        }
    }
}