File System Example
Files:
Shows how QSimpleXmlNodeModel can be used to use XQuery on top of arbitrary data, in this case the file system.
Overview
The FileTree class, sub-class of QSimpleXmlNodeModel, uses QFileInfo internally for understanding files, but exposes them to the query engine as XML. Directories becomes a <directory/> elements and files <file/> elements. In addition they have attributes appropriately, to reflect paths, file sizes and names.
FileTree keeps an array of QFileInfo instances, and create QXmlNodeModelIndex instances that has an integer which is an index into this array. The FileTree class and the query engine passes these back and forth when referring to nodes.
|