COS 2614 assignment 3 solutions
4.1 Question 1 The aim of this question is to expand your knowledge of Graphical User Interface programming by including menus on the user interface as well as using QActions for event handling. Some comments on this solution: • Each edit option (Bold, Underline and Italics) is included on the edit menu, where each option is added as a QAction. • In order to apply an edit option on a given text, firstly select the text in the text edit and then choose an edit option. • Event handling code for the edit options are grouped in the actionEvent()function. • Note that the text edit is a data member of the class, whereas the edit menu is just a local variable of the constructor. This is because we want to make the text edit accessible to the actionEvent() slot triggered by the menu options. 4 In general, it is better to keep as many widgets as possible as local variables of the constructor (or setupGUI() function), and only make those that need to be accessed by other slots and member functions, data members. • Note that the text edit provides an undo facility. This works, not only for typing, but also for formatting actions. Given below are two sample screen prints of the program while it is running: 4.2 Question 2 The aim of this question is to introduce you to the Qt class QMap. Given below is a screen capture of the output produced by the program when running: Some comments on this solution: • We have separated the class definitions and implementations of Textbook and TextbookMap into separate header and cpp files respectively. • Ezust did not provide an implementation of the Textbook class. So you had to implement Textbook according the given definition. • QMap only allows direct lo
Geschreven voor
- Instelling
- University of South Africa
- Vak
- COS 2614_Exam_Pack
Documentinformatie
- Geüpload op
- 17 september 2021
- Aantal pagina's
- 8
- Geschreven in
- 2021/2022
- Type
- Tentamen (uitwerkingen)
- Bevat
- Onbekend
Onderwerpen
-
cos
-
2614
-
ass 3