I have three tree views in my application and every view have its model which basically looks like this:
|
|
|--------Printer1
| |
| |------------Tray1
| | |
| | |----------Paper type
| | |----------value
| | |----------Amount
| | |----------value
| |
| |------------Tray2
| |
| |----------Paper type
| |----------value
| |----------Amount
| |----------value
|
|--------Printer2
| |
| |------------Tray1
| | |
| | |----------Paper type
| | |----------value
| | |----------Amount
| | |----------value
| |
| |------------Tray2
| |
| |----------Paper type
| |----------value
| |----------Amount
| |----------value
|
|--------Printer3
|
|------------Tray1
| |
| |----------Paper type
| |----------value
| |----------Amount
| |----------value
|
|------------Tray2
|
|----------Paper type
|----------value
|----------Amount
|----------value
|
|
|--------Printer1
| |
| |------------Tray1
| | |
| | |----------Paper type
| | |----------value
| | |----------Amount
| | |----------value
| |
| |------------Tray2
| |
| |----------Paper type
| |----------value
| |----------Amount
| |----------value
|
|--------Printer2
| |
| |------------Tray1
| | |
| | |----------Paper type
| | |----------value
| | |----------Amount
| | |----------value
| |
| |------------Tray2
| |
| |----------Paper type
| |----------value
| |----------Amount
| |----------value
|
|--------Printer3
|
|------------Tray1
| |
| |----------Paper type
| |----------value
| |----------Amount
| |----------value
|
|------------Tray2
|
|----------Paper type
|----------value
|----------Amount
|----------value
To copy to clipboard, switch view to plain text mode
I have a function which creates this empty model. Every value field is empty. I need to be able to do three things:
One: When the user chooses the type of paper he wants for a specific tray on a specific printer and the amount of paper he need I need to set the corresponding value fields.
Two: I need to reset the model, clear all values.
Three: I need to retrieve all values, for storing, printing etc.
I thought about making new model every time and copying it to the model that is associated to the view but I am not sure since model inherits QObject plus it doesn't solve my need number three. I am sure there is an answer in the documentation but so far I failed to find it. If somebody could help me save some time and tell me where to look for a class or a function to use it would really help me.
All I need is a way to set and get the value of the specific item in the model.
Thanks in advance.
Bookmarks