100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Other

COS3711 Assignment 1 2024 solution

Rating
5,0
(2)
Sold
18
Pages
23
Uploaded on
13-05-2024
Written in
2023/2024

COS3711 Assignment 1 2024 solution. Please use CMake (and not qmake) when setting up your assignment projects. Qt Designer should not be used to design user interfaces, and you are expected to manually set up GUIs to ensure that you properly handle memory using Qt’s parent-child functionality. Good programming practices should be followed. Follow standard naming conventions: class names start with a capital letter, variable and function names start with a lowercase letter, using camelCase for names made up of multiple words. Ensure consistent code layout and use of blank lines. Use forward class declarations in header files. Use initialiser lists in constructors. Have proper GUI management: setting cursor focus, sequential tabbing, clearing input widgets (like text input fields being cleared and spin boxes being returned to some default value), and enabling and disabling buttons as appropriate. Provide appropriate user feedback. Your code should build and run without any warnings. 2. Questions Question 1 Write classes (as necessary, remembering to avoid any anti-patterns) that will manage software review data. The data itself consists of • the name of the software, • the date of the review, and • an indication of whether it is recommended or not. You should create a graphical user interface that allows a user to enter the data. Data should be stored in an appropriate container (allowing for several reviews to be recorded), and be printed to a console window when required. Test your code by adding at least 3 pieces of data. Below is an example of a possible interface.Question 2 Extend Question 1 so that it uses reflective programming techniques to access the data members of the object that holds the review data. Write another display function that does not use any public accessor functions (or a toString() function) to get access to the review data. Also add a button to display the review detail to the application window (so that the program now can print to the console or GUI window). When displaying the data to the application window, you cannot assume that you know beforehand how many properties there are, what they are called, or of what type they are. You need to loop through the properties and using reflective programming techniques, display the data to the application window. HINT: You will need to use QVariant. Question 3 Use Qt’s model/view framework to store and display music CD information. The following information should be stored in the model (a QStandardItemModel): • composer, • album name, • replacement value, and • a rating (out of 100). The information should be displayed in a table. The following functionality should be included. • There should be a header row. • The user should be able to add rows of data to the model. • The replacement value should always display the cents (even as .00). • Use a delegate to display the rating as a horizontal bar. This column should take up all the remaining space available. • The user should be able to sort the data by clicking on the column header on which the sorting should be implemented. • Where the replacement value is greater than or equal to R200, the row should be made a different colour. Note that this colour should also change if the user edits a replacement value (and it should return to the normal colour if the value drops below R200). • The user should be able to delete a row of data. Here is an example of the interface.Question 4 Write an application that uses regular expressions to check for telephone numbers and email addresses in a text file provided by a user. The following functionality should be included. • The user should be able to select the file to check using a standard file open dialog box. • The file should be displayed in the GUI. • The telephone numbers and email addresses should be highlighted/emphasized in some way in the text. An email address can be identified by a single @ symbol in the address; telephone numbers could be from any of the following formats: • • • • (000)000-0000 • (000)0000000 You may assume that the email addresses and telephone numbers are free standing, that is, they do not have brackets (or any other character) around them. See an example below. HINT: Consider using the QTextDocument, and QTextCursor classes.

Show more Read less














Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
May 13, 2024
Number of pages
23
Written in
2023/2024
Type
Other
Person
Unknown

Subjects

Content preview

COS3711 2024 ASSIGNMENT 1
SOLUTION
THERE IS A LINK TO THE ZIPPED FILE AT THE END OF THIS DOCUMENT



Crystal Indigo!
Crystal Indigo!
Providing all solutions you need anytime
+27 76 626 8187




**NOTE: if the GUI is displaying differently from what you desire just change
how the widgets are displayed. copy the code and run DO necessary
changes.

,//GUI representation
Question 1

,Question 2

,Question 3

,Question 4

,
, //Source code
Question 1

Mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QLineEdit>
#include <QDateEdit>
#include <QCheckBox>
#include <QPushButton>
#include <QVBoxLayout>
#include <QVector>
#include "review.h"

class MainWindow : public QMainWindow {
Q_OBJECT

public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();

private slots:
void addReview();
void displayReviews();

private:
QLineEdit *nameEdit;
QDateEdit *dateEdit;
QCheckBox *recommendBox;
QPushButton *addButton;
QPushButton *displayButton;
QVBoxLayout *layout;
QVector<Review> reviews;
};

#endif // MAINWINDOW_H




mainwindow.cpp
#include "mainwindow.h"
#include <QDebug>
#include <QLabel>

Reviews from verified buyers

Showing all 2 reviews
1 year ago

1 year ago

5,0

2 reviews

5
2
4
0
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
CrystalIndigo University of South Africa (Unisa)
View profile
Follow You need to be logged in order to follow users or courses
Sold
486
Member since
5 year
Number of followers
226
Documents
73
Last sold
2 months ago
CrystalIndigo Solutions

providing all solutions to all computer science modules

4,1

51 reviews

5
27
4
13
3
6
2
1
1
4

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions