The grid offers an easy way to save and restore the grid layout - that is, the location of its main elements. You can save column properties, bands, focus location, grouping and sorting settings. The layout can be saved directly to a file or a child of QIODevice. XML is used for storing this information.
This mechanism is used when you need to restore the initial grid layout after the changes made by the user. The same mechanism is applied when you need to have different grid layouts for different situations. You just need to have several files with saved layouts and load them when needed.
Use the following code to save a grid layout into a file:
Qtitan::Grid* grid = new Qtitan::Grid; .... grid->saveLayoutToFile("c:\\layout01.xml");
Use the follwing code to load a layout from a file:
Qtitan::Grid* grid = new Qtitan::Grid; ... grid->loadLayoutFromFile("c:\\layout01.xml");
The availability of this functionality depends on the QtXml module. You can compile the grid without this dependency. To do it, use the QTITAN_NOUSE_QXML definition in your project. In this case, the layout saving/loading mechanism will not be available.