[Qt-interest] Saving the state of all your widgets.

Benjamin Meyer benjamin.meyer at torchmobile.com
Wed Mar 4 19:36:09 CET 2009


On Mar 4, 2009, at 1:19 PM, Pascal Patry wrote:

> There are no easy and simple ways already implemented, however you  
> can do it pretty
> easily.

Checkout KAutoConfig  http://www.icefox.net/programs/?program=KAutoConfig 
.  I have a Qt4 version that I can send to you if you want.

> By using QObject::children(), you can go through all the QWidgets of  
> the application. You
> may need to do it recursively, but that's not really complicated.
>
> Once you have the complete list, you can use QObject::inherits() to  
> know if the type
> interests you. If it does, then you can get the needed data through  
> QObject::property().
>
> Other than this implementation, you should consider having a struct/ 
> list that describes
> all the interested properties for the "class name". For instance:
>
> "QSpinBox" -> "value"
> "QLineEdit" -> "text"

Checkout the UserRole of each widget.  This will tell you what to save/ 
load

-Benjamin Meyer



More information about the Qt-interest-old mailing list