Skip to content

Add a new Config class that sets project level configurations to the qgs file#156

Merged
suricactus merged 1 commit into
masterfrom
QF-8226-config
May 21, 2026
Merged

Add a new Config class that sets project level configurations to the qgs file#156
suricactus merged 1 commit into
masterfrom
QF-8226-config

Conversation

@suricactus
Copy link
Copy Markdown
Collaborator

Previously one was required to use ProjectProperties and to explicitly define a getter and setter for a given property. This was tiresome, repetitive
and error prone.

Defining settings now is much more simplistic:

class Config:
    def __init__(self, project: QgsProject) -> None:
        self.project = project

    create_base_map = pfield(bool, "/createBaseMap", False)

Where pfield is a function that takes:

  1. data type of the project property
  2. path of the property after the prefix (prefix is QFieldSync) 3) default value of the property if any

The rest of the "magic" is within the Field type.

This is very similar to what settings_manager does and it will eventually replace it.

@duke-nyuki
Copy link
Copy Markdown

@suricactus suricactus force-pushed the QF-8226-config branch 2 times, most recently from 9021632 to 9f5067d Compare May 9, 2026 23:48
…e qgs file

Previously one was required to use `ProjectProperties` and to explicitly define
a getter and setter for a given property. This was tiresome, repetitive
 and error prone.

Defining settings now is much more simplistic:

```
class Config:
    def __init__(self, project: QgsProject) -> None:
        self.project = project

    create_base_map = pfield(bool, "/createBaseMap", False)
```

Where `pfield` is a function that takes:
1) data type of the project property
2) path of the property after the prefix (prefix is `QFieldSync`)
3) default value of the property if any

The rest of the "magic" is within the `Field` type.

This is very similar to what `settings_manager` does and it will eventually
replace it.
Copy link
Copy Markdown
Member

@nirvn nirvn left a comment

Choose a reason for hiding this comment

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

Definitely makes the whole project properties side of things easier to maintain / expand

@suricactus suricactus merged commit b83bfa4 into master May 21, 2026
8 checks passed
@suricactus suricactus deleted the QF-8226-config branch May 21, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants