Skip to content

ObaidUllah-10/cpp-inventory-management-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StockPilot

A desktop inventory management system built with C++17 and Qt 6 Widgets, backed by SQLite. Designed for small warehouses and shops that need accurate stock levels, a clean audit trail, and low-stock alerts — without a server.

Features

Dashboard — live KPI cards (product count, total stock value, low-stock count, supplier count), an animated stock-by-category bar chart with hover tooltips, a low-stock watchlist, and the latest movements.

Products — full CRUD with live search, category filter, and a low-stock-only toggle. SKUs are enforced unique, low quantities are highlighted in red, and the current view can be exported to CSV. Quantity is deliberately locked in the edit dialog: stock levels only change through recorded movements, so the audit trail always matches the shelf.

Stock movements — stock in, stock out, and absolute adjustments, each recorded atomically inside a database transaction with a live before/after preview. Negative stock is impossible by design (a CHECK constraint plus application-level validation).

Suppliers — vendor directory with contact details and a live count of products per supplier. Deleting a supplier keeps its products and clears the link (ON DELETE SET NULL).

Movements log — an immutable audit trail of every unit in, out, or adjusted, searchable by product and filterable by type.

Everything refreshes reactively: any write anywhere in the app emits a single dataChanged() signal that every page listens to.

Screenshot

Dashboard

Products

The UI uses a dark "night shift" theme — deep slate surfaces with a safety-amber accent taken from warehouse pick-lane signage, and monospace type reserved for SKUs and figures.

Building

Requirements

  • CMake ≥ 3.16
  • A C++17 compiler (GCC, Clang, or MSVC)
  • Qt 6 (Widgets + Sql modules) with the SQLite driver

On Ubuntu/Debian:

sudo apt install cmake build-essential qt6-base-dev libqt6sql6-sqlite

On Windows/macOS, install Qt 6 via the Qt online installer and make sure CMake can find it (-DCMAKE_PREFIX_PATH=/path/to/Qt/6.x/gcc_64 or equivalent).

Compile & run

git clone https://github.com/<you>/StockPilot.git
cd StockPilot
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
./build/StockPilot

The database is created on first run at the platform's per-user data location (e.g. ~/.local/share/StockPilot/stockpilot.db on Linux, %APPDATA%/StockPilot on Windows) and is seeded with sample products and suppliers so the app is explorable immediately. Delete the file to start fresh.

Project structure

StockPilot/
├── CMakeLists.txt
├── resources/
│   ├── resources.qrc         # Qt resource bundle
│   └── styles.qss            # application-wide stylesheet
└── src/
    ├── main.cpp              # entry point, stylesheet + DB bootstrap
    ├── DatabaseManager.*     # all SQL lives here (singleton data layer)
    ├── MainWindow.*          # shell: sidebar navigation + page stack
    ├── pages/                # Dashboard, Products, Suppliers, Movements
    ├── dialogs/              # Product, Supplier, and Stock-movement dialogs
    └── widgets/              # StatCard, custom QPainter bar chart

Architecture notes

  • Single data-access layer. No widget touches SQL. DatabaseManager exposes typed helpers and emits dataChanged() after every successful write, which keeps all four pages in sync with one connection per signal.
  • Transactional stock movements. recordMovement() updates the product quantity and appends to the movements log inside one SQLite transaction, so the two can never drift apart.
  • Schema constraints as a second line of defense. Unique SKUs, non-negative quantities, and movement types are all enforced by the schema in addition to UI validation.
  • No QtCharts dependency. The dashboard chart is a ~150-line QPainter widget with a grow-in animation and hover tooltips, keeping the build to Qt 6 base modules only.

Database schema

Table Purpose
products SKU, name, category, supplier link, quantity, reorder level, prices
suppliers vendor contact details
movements append-only log: IN / OUT / ADJUST, quantity, note, timestamp

License

MIT — see LICENSE.

About

StockPilot is a complete, compile-verified Qt6 inventory management system

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors