Skip to content

Conversation

nirvn
Copy link
Member

@nirvn nirvn commented Sep 14, 2025

This PR adds a menu in the feature addition form that allows for users to quickly activate / deactivate the pin tool button that dictates whether a given attribute value will be remembered and reused during the next feature addition.

Screenshot:

image

In addition, logic can be added into QField now, in preparation for QGIS 4.0, where the reusing of value functionality has been improved, with distinct options to activate/deactivate the possibility to reuse values and whether they should be remembered by default. The only thing left to do after this will be a vcpkg rebase when we get closer to QGIS 4.0 release date (or a manual patch if needed).

A bit more on this: it will answer the repeated asks by the community to get a way to get rid of the "remember last value" button in the feature addition form. That's quite exciting to me :)

@qfield-fairy
Copy link
Collaborator

qfield-fairy commented Sep 14, 2025

@nirvn nirvn changed the title Prepare QField to adopt reuse of remembered last value improvements Remember/reuse last value improvements Sep 14, 2025
Comment on lines +934 to +935
width: 49
height: 48
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 49 - 48 ?

Comment on lines +352 to +369
void AttributeFormModelBase::activateAllRememberValues()
{
QMap<QStandardItem *, int>::ConstIterator fieldIterator( mFields.constBegin() );
for ( ; fieldIterator != mFields.constEnd(); ++fieldIterator )
{
setData( fieldIterator.key()->index(), true, AttributeFormModel::RememberValue );
}
}

void AttributeFormModelBase::deactivateAllRememberValues()
{
QMap<QStandardItem *, int>::ConstIterator fieldIterator( mFields.constBegin() );
for ( ; fieldIterator != mFields.constEnd(); ++fieldIterator )
{
setData( fieldIterator.key()->index(), false, AttributeFormModel::RememberValue );
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation of activateAllRememberValues and deactivateAllRememberValues is clear and consistent with the codebase;

However, currently, these functions apply to all fields, regardless of whether CanRememberValue is true.

for added robustness, you might check CanRememberValue before setting RememberValue, otherwise everything looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants