-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[MU4 Issue] New Score creation: switching back and forth between instruments and templates #14342
Comments
I'd like to take a crack at this. |
@L0uisc - feel free. I'll add you to the project. |
Let me know when you think you've cracked it and I'll add the fix to an upcoming release. Thanks! |
This will take some cracking, mostly because I don't have a feeling for how QML and C++ models interact. Are there any good resources I can try to read/study to get up to speed? |
There is only a handful of things you can do with C++ models in QML:
So you cannot access any QML things from within the C++ model; only the other way around. If you want to call a QML method from C++, then you should emit a signal instead, and listen for that signal in QML. |
Ok, so I now know the following:
When I put a breakpoint in the constructors of The solution would be to somehow prevent destruction and recreation of whichever one of |
@L0uisc That's a very useful investigation! The views are destroyed because every time only one of them is instantiated by the However, this might have the disadvantage that both views are completely loaded in memory, even though only one is visible at a time. Therefore, an alternative solution would be to instantiate the Hope this helps! |
@cbjeukendrup I too hope it helps 😅 I'll see what I can figure out. |
I finally got around to this again. I tried an evening to get the solution with the Would that be OK for a PR, or do you want me to get the better option of only keeping the part we really want to persist between tab switches working? @cbjeukendrup (tagging you since you were the team member who was involved with this previously.) |
@L0uisc Yes, feel free to open a PR for that solution! (It has the additional advantage that things like selected template or selected instrument category are persisted too.) |
You are correct, it has more utility when both pages are kept around in their entirety. I also think memory use is not too much of an issue. The NewScore dialog is never open when e.g. playback or import is ongoing. |
Hmm... I see. I'm not going to get round to this soon. If somebody else wants to work on it, they're welcome. I'll look into this if I get the time again and nobody else started working on it. |
If the New score dialog is ever refactored, I would like to request the opposite of this issue. That is, it ought to be possible to select a template, then add or edit the instrument list from there. |
Hi, if this issue is still valid then I want to work on this issue. I need some help. @cbjeukendrup you mentioned the instantiate the InstrumentsOnScoreListModel outside the Loader. Can you please give some more hints. After searching online I found this approach ,we can use property string to store the selected instruments, when we switch to template page and then switch back to instruments the we can restore the instruments list from property string: |
The specific So what we want to do, is making sure that the model of the selected instruments is stored outside the tab, so that it is not lost. InstrumentsOnScoreListModel {
id: instrumentsOnScoreModel
} You basically want to cut this, and paste it in Last but not least: |
@cbjeukendrup thank you for you detailed and precise instructions. It helped me a lot to understand qml properties. I open pull request for this issue but this pull request is not solving the issue. Musescore is running properly in my machine but NewScore creation is not working can you please check my code, where I am doing wrong. basically I getting this kind of errors in my application output window:
|
When creating a new score by adding individual instruments but then thinking "wouldn't a template exist for this" and clicking on the templates tab, the already entered individual instruments get forgotten. thus, when seeing no template exists for what you want and returning to the instruments tab you are greeted by an empty field and have to start over from scratch. It would be nice to see MU4 remembers what you already added and only delete that selection when you choose to go for a template.
The text was updated successfully, but these errors were encountered: