Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a GUI application that records items of stock for a business. A barcode, description, stock level and price are recorded for each item. New

Write a GUI application that records items of stock for a business. A barcode, description, stock level and price are recorded for each item. New items must be able to be added, and existing items must be able to be changed or deleted.


The main window should have a menu bar, with menus File and Edit. The File menu should have options Open, Save and Exit, and the Edit menu should have options to Add, Change and Remove. The main window should also have a toolbar (directly under the menu bar) with a toolbar button for each of these options. See Figure 1.

 

student submitted image, transcription available below

Figure 1

 

The following should occur when the user chooses each of the options:
Open: A file dialog should be displayed, allowing the user to select the name of a text file containing all the items captured previously.


Save: A file dialog should be displayed, allowing the user to select the name of the text file in which the items captured thus far should be saved.


Exit: The program should exit. If the data has been changed since it was last saved, the program should warn the user and allow the data to be saved if required.


Add: A dialog should be displayed consisting of a form that allows the user to specify the barcode, description, stock level and price of an item. If the user attempts to add an item that has been added previously, the program should tell the user that an item with this barcode already exists, and ask whether the stock should be increased.


Change: A dialog should be displayed allowing the user to specify a barcode. Another dialog must then be displayed with a form already populated by the data for that item. The user should be allowed to change any of the fields except the barcode.


Remove: A dialog should be displayed allowing the user to specify a barcode. If an item with the barcode exists, the user should be asked for confirmation before it is deleted.


In the centre of the window, a list of all the items should be displayed, sorted in order of their barcodes, and should reflect any changes made by performing the options. See Figure 2.

student submitted image, transcription available below

Figure 2

 

Implementation requirements:
• You may not use Qt Designer to create the user interface. You must code the GUI manually.
• You should adhere to good design principles and your program should provide user-friendly feedback to the user.
• The program must separate the model from the view. The model consists of the non-visual classes used to create, edit and store the items in stock. The view consists of the graphical user interface including the main window with the menus, toolbar and edit box, and the other dialog boxes that are displayed.
• You must use a QMap to store the items in stock in the order of their barcodes. Note that this is part of the model, so the QMap should not be stored in, or be directly accessed by, the view. All access to it should be through the operations provided by the model.
• Opening a file to load the items in stock into the model, and saving the items in stock in a file, are part of the model. The view code should therefore not do any file handling – this should all be managed by the model.
• We have provided Item, ItemReader and ItemWriter classes (in Additional Resources) for part of the model. You must use these classes without changing them.

 

Hints:
You can use a static member function of QFileDialog to allow the user to choose a file to open or to save.


Remember that you must submit a program that compiles correctly and displays something on the screen, to obtain marks for this question. This is a complex application to complete, so we recommend that you build it incrementally, making sure that each new feature compiles and works correctly before adding the next feature.
Approximately a third of the marks will be allocated to the model. Another third will be allocated to the view, and the remaining marks will be allocated to the functionality of linking the model to the view.
Setting up the view is not difficult. The tricky bit is to get the toolbar buttons to perform the same actions as the options on the menus. You should be able to design and implement the model fairly easily with the knowledge you have gained from the first two assignments. The trickiest part is linking the model and view together, so that any actions on the view change the model, and that any changes to the model are reflected in the view.

 

This GUI Application must be coded using C++ Qt5.
 
 

Stock Editor File Edit Open S Save X Exit ACR 0 X

Step by Step Solution

3.48 Rating (141 Votes )

There are 3 Steps involved in it

Step: 1

I see youre looking to create a GUI application using C and Qt5 to manage stock for a business The application needs to have a menu bar toolbar and the ability to perform CRUD operations Create Read U... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Design

Authors: Alan Dennis, Barbara Wixom, Roberta M. Roth

7th Edition

1119496489, 978-1119496489

More Books

Students also viewed these Programming questions