A lightweight vector graphics editor built with C++17 and the Qt5 framework. This application allows users to create, view, and modify vector graphics with various shapes and tools.
- Shape Support: Draw multiple geometric shapes including:
- Circles
- Rectangles & Rounded Rectangles (with adjustable corner radius)
- Hexagons
- Lines
- Infinite Canvas: The drawing area has no edges. Pan in any direction and zoom from 5% to 4000% (see Canvas Navigation).
- Freehand Drawing: Sketch freely on the canvas.
- Text Support: Add text annotations with font family and size customization. Double-click to edit existing text.
- Object Manipulation:
- Move: Drag shapes around the canvas.
- Resize: Interactive resizing handles for shapes.
- Delete: Remove selected objects (Delete key).
- Clipboard & History:
- Undo/Redo: Full history support to revert and re-apply changes.
- Cut, Copy, Paste: Standard clipboard operations for shapes.
- Styling:
- Customizable Fill Color and Stroke Color (support for transparency).
- Adjustable Stroke Width.
- Predefined color palette and custom color pickers.
- Fill and Stroke tools for quick coloring.
- File Operations:
- Create New projects.
- Open existing diagrams.
- Save and Save As functionality (supports SVG export).
- Close current project.
## Prerequisites
To build and run this project, you need the following installed:
- C++ Compiler supporting C++17 (e.g., GCC, Clang, MSVC).
- CMake (version 3.16 or higher).
- Qt 5 (specifically the
Widgetsmodule).
-
Clone the repository (if you haven't already):
git clone <repository-url> cd Micro-Vector-Graphics-Editor
(Note: Ensure you are in the directory containing
CMakeLists.txt) -
Create a build directory:
mkdir build cd build -
Configure the project with CMake:
cmake ..
-
Build the application:
make
(Or
cmake --build .on Windows/other systems) -
Run the application:
./program
Two helper scripts are available at the project root:
./start: Configures CMake, builds the project, and runs the application../clean: Removes thebuild/directory.
Usage:
./start
./cleanThe source code is organized as follows:
src/: Contains all source code.main.cpp: Entry point of the application.gui/: Handles the graphical user interface.mainwindow/: Implementation of the main window logic (menus, toolbar connections).canvas/: The drawing area implementation, handling mouse events and painting.headers/: Header files for GUI components.
model/: Contains the data structures for vector objects.implementation/: Logic for shapes (Circle, Line, Hexagon, etc.) and their SVG representation.headers/: Class definitions for the shapes.
diagram/: Manages the collection of shapes (the document model).resources/: Icons and Qt resource files (.qrc).
- Toolbar: Select tools (Shapes, Freehand, Text) from the toolbar.
- Color Selection: Use the color swatches or entering color codes to change Fill/Stroke.
- Canvas: Click and drag on the canvas to draw shapes.
- File Menu: precise control over New, Open, Save, and Save As operations.
| Action | Mouse / Touchpad | Keyboard |
|---|---|---|
| Pan | Drag with the middle or right mouse button, or scroll (two-finger scroll on a touchpad) | – |
| Pan sideways (mouse) | Shift + scroll | – |
| Zoom in / out at the cursor | Ctrl + scroll | Ctrl + + / Ctrl + - (zooms at the canvas centre) |
| Reset view (100%, original position) | – | Ctrl + 0 |
- Zoom ranges from 5% to 4000%. Selection handles and click areas stay the same size on screen at every zoom level.
- New and Close reset the view. Open shows the whole drawing, zooming out if it doesn't fit.
- Saved SVG files include a
viewBoxcovering every shape, so drawings placed anywhere on the canvas (including negative coordinates) display fully in other SVG viewers.
- Manya Jain