Good question and question to which I would very much like to get an answer!
Well, clearly not, since for example scrollTo() doesn't work as expected when called from within showEvent(). It seems to me that QTreeView needs a bit more time to fully initialise itself which might explain why showing a dialog box just before calling scrollTo() makes scrollTo() to work...
Have you tried to qApp->processEvents(); instead of displaying dialog box ?I have got things to work by displaying a dialog box just before doing to the autoresizing or scrolling, and it was fine
Please provide a test case where scrollTo() doesn't work as expected.
I have tried that too (by having a while loop with qApp->processEvents(); in it -- yes, it was a quick and dirty way of testing things at that stage), but to no avail. What I did, if I recall correctly was to test for QTreeView to be visible, but that didn't quite work as I expected (I seem to remember that things were hanging up, but I might have something wrong back then, can't remember for certain).
Indeed a loop on processEvents() does not seem clean
If you have a treeview, you must have an associated model (or you meant treewidget?)
Try to catch a signal from this model, indicating it finished to load its data; if you don't find such signal, try to implement something equivalent. Then you read treeview settings, after its data has been updated
Well, I did warn you...
I do indeed have an associated model (a QFileSystemModel object).
I am not aware of any such signal. I did, however, try to 'play' with the expanded() signal, but again to no avail.
Anyway, I am nearly done with what I needed to do, so I should soon be able to resume that aspect of my work.
As i understand your problem not in settings your problem in show/hide some properties of widgets. You can do save to file (as txt) your needed widgets as boolean or in integers (with specific values) then when your program opens read them from file and show/hide needed widgets.
not as txt as xml is more good way
Bookmarks