GUI-based Inventory Management System built with C++20 and Qt6 Widgets.
Manage Products, Suppliers, and Inventory Transactions, track stock levels, compute inventory value, run analytics, and save/load data from files (.txt).
CPP-Project-Inventory-Management-System/
│
├── CMakeLists.txt # Build configuration (CMake + Qt6 + GoogleTest)
├── README.md # This file
├── BUILD.md # Detailed build/setup instructions
├── GIT_WORKFLOW.md # Git branching and contribution guidelines
├── WORK_ASSIGNMENTS.md # Team member task assignments
│
├── src/ # All .cpp implementation files
│ ├── main.cpp # Entry point — creates QApplication and MainWindow
│ ├── MainWindow.cpp # Top-level window; hosts all pages via QTabWidget
│ │
│ ├── Product/
│ │ └── Product.cpp # Product data class (ID, name, category, price)
│ │
│ ├── Supplier/
│ │ └── Supplier.cpp # Supplier data class (ID, name, phone, email)
│ │
│ ├── Inventory/
│ │ ├── InventoryItem.cpp # Abstract base class — shared item fields
│ │ ├── StandardItem.cpp # Derived: value = quantity × unitPrice
│ │ ├── BulkItem.cpp # Derived: value accounts for bulk discount
│ │ └── RecordItem.cpp # Transaction record (Stock In / Stock Out)
│ │
│ ├── Managers/
│ │ ├── InventoryManager.cpp # Central logic — manages all data collections
│ │ └── DataManager.cpp # Static file I/O — saves/loads all data to .txt
│ │
│ └── Pages/
│ ├── ProductsPage.cpp # Qt page: add/edit/delete/search products
│ ├── SuppliersPage.cpp # Qt page: add/edit/delete/search suppliers
│ ├── InventoryPage.cpp # Qt page: add items, stock in/out, search/filter
│ ├── RecordsPage.cpp # Qt page: full transaction log view
│ └── AnalyticsPage.cpp # Qt page: total value, low stock, averages, categories
│
├── include/ # All .h header files (mirrors src/ layout)
│ ├── MainWindow.h
│ ├── RecordsPage.h
│ │
│ ├── Product/
│ │ └── Product.h
│ │
│ ├── Supplier/
│ │ └── Supplier.h
│ │
│ ├── Inventory/
│ │ ├── InventoryItem.h # Pure virtual computeValue() — forces override
│ │ ├── StandardItem.h
│ │ ├── BulkItem.h
│ │ └── RecordItem.h
│ │
│ ├── Managers/
│ │ ├── InventoryManager.h
│ │ └── DataManager.h
│ │
│ ├── Analytics/
│ │ └── AnalyticsEngine.h # Template class — header-only (no .cpp needed)
│ │
│ └── Pages/
│ ├── AnalyticsPage.h
│ ├── InventoryPage.h
│ ├── ProductsPage.h
│ └── SuppliersPage.h
│
├── ui/ # Qt Designer .ui files (XML layout definitions)
│ ├── mainwindow.ui # Main window layout
│ ├── analyticshomepage.ui
│ ├── inventorypage.ui
│ ├── productspage.ui
│ ├── supplierspage.ui
│ └── recordspage.ui
│
├── data/ # Persistent data files (plain text, auto-loaded)
│ ├── products.txt # Saved product catalogue
│ ├── supplier.txt # Saved supplier list
│ ├── inventory.txt # Saved inventory items (type + fields per line)
│ └── recorded.txt # Saved transaction records
│
├── resources/
│ ├── resources.qrc # Qt resource manifest (bundles styles at compile time)
│ └── styles.qss # Global Qt stylesheet
│
├── Tests/
│ └── InventoryManagerTests.cpp # GoogleTest unit tests for InventoryManager logic
│
├── run_app.sh # Shell script to build and launch the application
└── run_tests.sh # Shell script to build and run the unit tests
src/main.cpp creates the QApplication and instantiates MainWindow.
MainWindow (src/MainWindow.cpp / include/MainWindow.h) owns a single InventoryManager instance and passes a reference to each of the five page classes. It also calls DataManager to load all saved data on startup and save on exit.
Each page class (ProductsPage, SuppliersPage, InventoryPage, RecordsPage, AnalyticsPage) holds a reference to the shared InventoryManager. Pages read from the manager to populate tables and write to it when the user adds, edits, deletes, or performs stock transactions. No page talks to another page directly.
InventoryManager (src/Managers/InventoryManager.cpp) is the single source of truth for all runtime data. It owns:
std::unordered_map<std::string, Product>— the product cataloguestd::unordered_map<std::string, Supplier>— the supplier liststd::vector<std::unique_ptr<InventoryItem>>— polymorphic inventory itemsstd::vector<RecordedItem>— transaction records
DataManager (src/Managers/DataManager.cpp) provides static methods (loadProducts, saveProducts, etc.) that read from and write to the .txt files in data/. It receives and returns data via the containers owned by InventoryManager. No data is stored inside DataManager itself.
InventoryItem (abstract base — include/Inventory/InventoryItem.h)
├── StandardItem — computeValue() = quantity × unitPrice
└── BulkItem — computeValue() = quantity × unitPrice × (1 − bulkDiscountRate) / qtyPerBulkUnit
AnalyticsEngine<T> (include/Analytics/AnalyticsEngine.h) is a header-only template class that accepts any inventory item type. It computes total value, average value, low-stock lists, and category groupings. AnalyticsPage instantiates it for both StandardItem and BulkItem and merges the results.
Tests/InventoryManagerTests.cpp uses GoogleTest (fetched automatically by CMake via FetchContent). The test executable links against the same .cpp sources as the main app (excluding Qt UI files) so business logic is tested in isolation without the GUI.
- Add / Edit / Delete products
- Fields: numeric ID, name, user-defined category, price
- Search by name or ID, filter by category (dropdown)
- Product catalogue is the source for creating inventory items
- Add / Edit / Delete suppliers
- Fields: ID, name, phone number, email
- Search suppliers by name or ID
- Two item types: StandardItem and BulkItem
StandardItem: value =quantity × unitPriceBulkItem: supports a bulk discount rate (0.0–1.0) and quantity per bulk unit; value accounts for discount
- Record transactions: Stock In / Stock Out
- Stock-out blocked if quantity requested exceeds available stock
- Search by name and filter by category; table sorted by ID
- Full transaction log of all Stock In / Stock Out events
- Shows: item ID, item name, transaction type, quantity changed
- Persisted to file alongside inventory data
- Powered by
AnalyticsEngine<T>— a generic template class - Total inventory value across all items
- Low-stock list with a configurable threshold (default: 10 units)
- Average item value
- Items grouped by category (count per category)
DataManageruses static methods — no instance needed- Saves/loads: products, suppliers, inventory items, and transaction records (
.txt) - Data loaded automatically on startup
- File paths configurable at runtime via the menu bar
- Corrupted or missing files handled with
QMessageBoxerror dialogs
| Feature | Where Used |
|---|---|
| Abstract base class with pure virtual | InventoryItem::computeValue() |
| Polymorphism | std::unique_ptr<InventoryItem> storing StandardItem / BulkItem |
| Template class | AnalyticsEngine<T> (header-only) |
| Smart pointers | std::unique_ptr<InventoryItem> in InventoryManager |
| STL containers | std::vector, std::unordered_map, std::map throughout |
| Operator overloading | operator<< on Product and TransactionType |
| Friend function | operator<< declared friend in Product |
| Non-copyable / non-movable class | InventoryManager (deleted copy/move constructors) |
| Static methods | DataManager — all methods are static |
| Const-correct overloaded getters | InventoryManager provides const and non-const versions of all getters |
- C++20
- Qt6 Widgets (GUI)
- CMake 3.16+ (build system)
- GoogleTest (unit testing — fetched automatically)
Full instructions are in BUILD.md. Quick start:
# 1. Configure
cmake -B build -S .
# 2. Build
cmake --build build
# 3. Run the application
./build/InventoryManagementApp
# 4. Run unit tests
cd build && ctest --output-on-failureAlternatively, use the provided scripts:
./run_app.sh # Build and launch the application
./run_tests.sh # Build and run unit tests