Question

Is there a way that Qt could save UI settings automatically , without calling QSettings::setValue () ? e.g In a QMainWindow , save the font size of QMenu automatically

Thanks !

Was it helpful?

Solution

QMainWindow has functions saveState and restoreState and also derives from QWidget save and restore geometry. However as documentation here states only settings that you will be able to restore are just that: a mainwindow state and geometry. It seems unavoidable that you will have implement storage of settings for individual widgets. In the link above Qt guys give a good snippet on how to accomplish this in mainwindow derivatives.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top