To monitor the contents of the program, which will be updated by the program changed signal, a Program View dock widget was added to the right side of the application GUI using Designer. A dock widget can be docked to any side of the window, through this dock widget was restricted to the left and right sides. A dock widget can also be undocked from the main window.
A QListView widget was added to the Program View dock widget. The editTriggers property was set to NoEditTriggers to prevent editing and the selectionMode property was set to NoSelection to prevent selection. In other words, this list view was made read-only.
A QListView is meant to work with a data model. Eventually a custom Program Model will be created that will hold the program. The MainWindow class will contain a pointer to the Program Model. To keep it simple to start, the predefined QStringListModel was used. This model simply maintains a list of strings, which for now are set to the program line strings.
The program model is instanced in the MainWindow constructor, which must be done before the edit box is instanced, since the edit box will generate a program change signal. This model is then assigned to the QListView widget. Any changes to the model will be reflected in the dock widget. The program changed slot in main window was modified to update the program model as changes are received instead of outputting the changes to the console.
[commit 60e125362e]
Saturday, March 9, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)