Try these questions to test your knowledge from this chapter:
- Assuming we have a well-designed model-view application, is the following code part of a model or a view?
def save_as(self):
filename, _ = qtw.QFileDialog(self)
self.data.save_file(filename)
- Can you name at least two things that a model should never do and two things that a view should never do?
- QAbstractTableModel and QAbstractTreeModel both have Abstract in the name. What does Abstract mean in this context? Does it mean something different in C++ from what it means in Python?
- Which model type—list, table, or tree—would best suit the following collections of data:
- The user's recent files
- A Windows registry hive
- Linux syslog records
- Blog entries
- Personal salutations (for example, Mr., Mrs., or Dr.)
- Distributed version control history
- Why is the following code failing?
...