Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StatusQ: Create generic proxy model GroupByModel #12683

Open
micieslak opened this issue Nov 10, 2023 · 3 comments · May be fixed by #14689
Open

StatusQ: Create generic proxy model GroupByModel #12683

micieslak opened this issue Nov 10, 2023 · 3 comments · May be fixed by #14689

Comments

@micieslak
Copy link
Member

Description

Proxy allowing grouping rows according to provided criteria. Grouped items are exposed by additional role holding submodel.

How the usage could look like:

    ListModel {
        id: srcModel

        ListElement {
            color: "purple"
            color2: "purple2"
            name: "a"
            extendedName: "abc"
        }
        ListElement {
            color: "red"
            color2: "red2"
            name: "b"
            extendedName: "abc2"
        }
        ListElement {
            color: "purple"
            color2: "purple2"
            name: "c"
            extendedName: "abc4"
        }
        ListElement {
            color: "purple"
            color2: "purple2"
            name: "d"
            extendedName: "abc2"
        }
        ListElement {
            color: "green"
            color2: "green2"
            name: "e"
            extendedName: "abc9"
        }
        ListElement {
            color: "green"
            color2: "green2"
            name: "f"
            extendedName: "abc9"
        }
    }

    GroupModel {
        id: groupModel

        sourceMode: srcModel
        submodelRoleName: "submodel"

        groupBy: "color"


        bypassRoles: ["color2"]
    }

The output model in intended to contain number of rows equal to number of unique values of role indicated via groupBy property.
Submodel is intended to be available via role name specified via submodelRoleName property.

By default output model contains two roles on top-level - the one specified in groupBy and the one containing model specified in submodelRoleName. However additional roles can be exposed in top-level model using bypassRoles property. The value comes from an arbitrary entry in the submodel so should be used whenever the role value is the same for all entries in submodel.

The output model then would be equivalent to model depicted below:

ListModel {
    id: groupped
    
    ListElement {
        color: "purple"
        color2: "purple2"

        submodel: [
            ListElement {
                color: "purple"
                color2: "purple2"
                name: "a"
                extendedName: "abc"
            },
            ListElement {
                color: "purple"
                color2: "purple2"
                name: "c"
                extendedName: "abc4"
            },
            ListElement {
                color: "purple"
                color2: "purple2"
                name: "d"
                extendedName: "abc2"
            }
        ]
    }
    
    ListElement {
        color: "red"
        color2: "red2"
        submodel: [
            ListElement {
                color: "red"
                color2: "red2"
                name: "b"
                extendedName: "abc2"
            }
        ]
    }
    
    ListElement {
        color: "green"
        color2: "green2"
        submodel: [
            ListElement {
                color: "green"
                color2: "green2"
                name: "e"
                extendedName: "abc9"
            },
            ListElement {
                color: "green"
                color2: "green2"
                name: "f"
                extendedName: "abc9"
            }
        ]
    }
}
@iurimatias
Copy link
Member

moving to 2.29 due to lack of space in this milestone, however this might be moved back during the 2.28 stabilization period

@micieslak
Copy link
Member Author

@iurimatias @alexandraB99 I think that it would be beneficial to finish this task. It has a big potential to improve performance and simplify UI code in various places, especially related to Wallet. The estimation here (3 points) its incorrect - it's big tasks, thousands line of code, component and tests. But it's like 80% done some time ago. So maybe we could reconsider finishing it in 2.29.0 to have ready for offsite and discuss it with a Wallet team.

@noeliaSD
Copy link
Contributor

noeliaSD commented Apr 9, 2024

First, to complete this task: #14370 and after conclusions, if necessary, this task can be taken.

@noeliaSD noeliaSD modified the milestones: 2.29.0 Beta, 2.30.0 Beta Apr 9, 2024
micieslak added a commit that referenced this issue May 10, 2024
@micieslak micieslak linked a pull request May 10, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

4 participants