Color widget implementations?

Hi,

I am experimenting with the color widget, which has been added to QField 4.0
In QGIS, the color widget opens the qgis color picker dialogue with the color wheel, color swatches etc.
However, on my Android 8 phone the color picker lets me choose between just five preset colors: red, blue, green, purple, orange.

Is this intended?
Is it a setting I can change?

Another thing I noticed: I added a field for color to a layer in an existing QField project and set it to color widget in the Attribute form.
In QGIS the color widget does not function at all. It is grayed out.
In QField it’s the same. No interaction what so ever, the field is grayed out.
Could it be that I created this project before QField 4.0 arrived? Because the color widget does work in a new project?
Or could I have messed up a setting somewhere that disables the color widget?

Hello @Jeroen-GroeneBij , it seems to be a limitation on the QField implementation, I’ve tried on Android phones and tablets with android 12 and 14, only have those 5 colours to choose from.

The greyed out I was not able to replicate, except by setting the attribute as not editable in the form.

Hi @cuprico , nicely spotted. The newly added fields were indeed set to non-editable.

I did not uncheck the Editable checkbox, so I started looking into why this happened. It seems to be related to having virtual fields.
I found that for any fields added after I have created a virtual field the checkbox is unchecked. This is not limited to QField projects so I have created an issue for this in the QGIS github: Fields added after creating a virtual field are non-editable by default · Issue #65377 · qgis/QGIS · GitHub

oh, nice find! I will check if the same thing happens on linux…

@cuprico the Editable checkbox issue has been narrowed down, see the comments in the issue.

wow! pretty peculiar bug indeed! is there a reason you add attributes using the Layer Properties > Fields > Add Field? It should be the same as using the Field Calculator, no? haven’t tried this myself yet…

No, I have no particular reason to use the Layer Properties route.

As far as I know there is no difference in the route Layer Properties > Fields > Add Field versus the route Attribute Table > Add Field

However, there is a small difference when using the Field Calculator. With the Field Calculator, you can not add a comment or an alias.
The Comment and Alias options are dataformat dependent however, a geopackage allows both, a shpfile does not.

1 Like

@Jeroen-GroeneBij , to answer your question regarding the color widget: ATM it has a fixed nb of colors yes. The vision is to also add the project colors defined in the project properties dialog here:

That’s an enhancement I hope we can make for QField 4.2.

1 Like