mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Object editation bugfixing and finishing
This commit is contained in:
@ -197,6 +197,7 @@ void PDFObjectEditorAbstractModel::setEditedObject(PDFObject object)
|
||||
if (m_editedObject != object)
|
||||
{
|
||||
m_editedObject = qMove(object);
|
||||
updateSelectorValues();
|
||||
emit editedObjectChanged();
|
||||
}
|
||||
}
|
||||
@ -240,6 +241,34 @@ QVariant PDFObjectEditorAbstractModel::getMaximumValue(size_t index) const
|
||||
return m_attributes.at(index).maxValue;
|
||||
}
|
||||
|
||||
void PDFObjectEditorAbstractModel::updateSelectorValues()
|
||||
{
|
||||
// Turn on selectors, which have some dependent attribute,
|
||||
// which have value in the persisted object.
|
||||
for (size_t index = 0; index < getAttributeCount(); ++index)
|
||||
{
|
||||
if (!queryAttribute(index, Question::IsSelector))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool hasPersistedAttribute = false;
|
||||
for (size_t dependentAttribute : getSelectorDependentAttributes(index))
|
||||
{
|
||||
if (!getValue(dependentAttribute).isNull())
|
||||
{
|
||||
hasPersistedAttribute = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasPersistedAttribute)
|
||||
{
|
||||
setSelectorValue(index, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t PDFObjectEditorAbstractModel::createAttribute(ObjectEditorAttributeType type,
|
||||
QByteArray attributeName,
|
||||
QString category,
|
||||
|
Reference in New Issue
Block a user