Recall that TreeModel uses setupModelData() to set up the initial tree structure. We provide a very brief description of its behavior here, and refer the reader to the code itself for more details (the code is in post IIIA). We begin with a text file (default.txt) that contains all the data for our tree:
Getting Started How to familiarize yourself with Qt DesignerThe entire text file is extracted in main, and sent to setupModelData() within TreeModel. Two tab-delimited strings are extracted from each line (the title and summary), and form the basis for a new TreeItem. The location of each node in the hierarchy is determined by the pattern of indentation in the file. We construct the tree exactly as discussed in Part II, using the following rules:
Launching Designer Running the Qt Designer application
The User Interface How to interact with Qt Designer
Connection Editing Mode Connecting widgets together
Connecting Objects Making connections in Qt Designer
Editing Connections Changing existing connections
- For each line, create a TreeItem in which the two tab-delimited strings on that line are assigned to TreeItem.itemData (Figure 4, post IIB).
- If line N+1 is indented relative to line N, then make the (N+1)th item a child of item N.
- If line N+1 is unindented relative to line N, then make the (N+1)th item a sibling of item N's parent.