Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Hiding implementation in cpp files



  • I was wondering if it would be possible to hide implementation of some methods permanently or just for the program to remember that I want to hide it every time I use Qt creator , as the method is 100 % done.


  • Lifetime Qt Champion

    Hi
    Make sure you have this on.
    alt text

    Then mine remembers what i folded.



  • @jkwok678
    All you have is Edit > Advanced > Toggle Fold All, and Creator seems to pretty limited about saving how you last viewed... :(


  • Lifetime Qt Champion

    Hi
    Make sure you have this on.
    alt text

    Then mine remembers what i folded.



  • @mrjj
    It does, but only for the last session. So once you read in some other project for whatever reason, you lose the folding remembered on the first project, right? That's what I meant by "limited". And in fact I do not have Restore last session on startup checked, but it does restore folding if I click the Open last session, so I think it's just a "last session" thing regardless of when/how you restore.

    Or do you find a way to remember previous sessions too?


  • Lifetime Qt Champion

    @JonB
    Hi mine still remembers it.
    I open another project and remove the first one.
    Close creator.
    Then i open the creator again, and it showing the non folded project.
    Then i loaded the closed project and it still
    had the folding info.
    So not sure when it will not be remembered.



  • @mrjj
    Sigh :(
    I just closed my project, opened an old one to discuss with someone. When I returned to the original project it had forgotten all folds :( So I assumed that was because I had changed project, so it was no longer "the previous session"....

    Now I can't repro that. In which case, how & when does Creator manage to forget all my folds? (I don't delete project.) I swear it must have a mind of its own/gremlins, sometimes....


  • Lifetime Qt Champion

    @JonB
    No sure. i cant reproduce here.
    I have been using load last session since day one so maybe why i never noticed.



  • @mrjj
    I think it is indeed something to do with using "sessions". If I sometimes do click to open a project from the list of projects it does not restore, but if I do it via "last session" it does. How this gets me when swapping between project I'm not sure.



  • Wait, what I mean is that I want to fold/hide implementations of complete methods and have that save so that next time I open the project in Qt creator, I don't have to hide them again


  • Lifetime Qt Champion

    @jkwok678
    hi
    yes if you enable session then yes.
    Also you can clone the session and rename it and always have one where its folded as you want.
    But jonB have seen it forgets it so it might have issues :)

    https://doc.qt.io/qtcreator/creator-project-managing-sessions.html



  • @mrjj said in Hiding implementation in cpp files:

    Also you can clone the session and rename it and always have one where its folded as you want.

    But then, over time your file contents change, so I assume it's useless restoring to an old session, it won't know where to do the folds now?

    For @jkwok678, just try as @mrjj says, set the session to auto-restore, and see how it goes for you.


  • Lifetime Qt Champion

    @JonB
    I not sure it stores the project in the session, only bookmarks, folding and such things.
    But i did not test this thesis.



  • @mrjj said in Hiding implementation in cpp files:

    I not sure it stores the project in the session, only bookmarks, folding and such things.

    Hmm. So I think you're saying: it's not to do with saving "old" sessions. By cloning the current default session, and saving it under the name of my project, I can use that named project session always with my project, and that named session will get updated with latest folds/bookmarks as I then change my project? If I switch over to some other session for some other project, I can still then return to the saved, named session for my main project and get back to where last saved?

    I'm going to try working like that now, and see how it goes.

    But then, if I change projects and it retains session to save to, my new project will start saving to my reserved session? What I want is: each project should save its folds/bookmarks wherever associated with that project, and restore from that, and save to that, period. I don't need to manage multiple sessions, I just want separate ones for each project. Automatically.

    Don't you just love Qt/Creator? ;-)


  • Lifetime Qt Champion

    @JonB
    Hi
    Yeah but sessions are not a project thing. Its a workspace.
    So a session can have one or more open projects.
    But yeah it would be useful if one could clone a session and then tie to a project so when you open that project the session would also open but not sure the design ever intended to work like that.

    Yeah I love creator :)



  • @mrjj said in Hiding implementation in cpp files:

    Yeah but sessions are not a project thing. Its a workspace.
    So a session can have one or more open projects.

    Ooohhhh, thanks!


Log in to reply