# daik0t/qt-gui architecture

> Architecture diagram of the GitHub repository daik0t/qt-gui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/daik0t/qt-gui
- Repository: https://github.com/daik0t/qt-gui

## Overview

This Qt desktop app lets users grow or reset a grid of red squares, then simulate a moving ray against the grid’s outer borders. The main workflow is coordinated in main.cpp: it collects square-neighbor border data, opens a preview window, and configures the ray’s obstacles and stopping barriers. The simulation’s timer, drawing, and collision behavior lives in RayWidget. Relationships below follow the provided excerpts; no README or other source files were provided.

Main entry points: [`main.cpp`](https://github.com/daik0t/qt-gui/blob/main/main.cpp) (Application setup), [`RayWidget.cpp`](https://github.com/daik0t/qt-gui/blob/main/RayWidget.cpp) (Ray simulation), [`BorderWindow.cpp`](https://github.com/daik0t/qt-gui/blob/main/BorderWindow.cpp) (Border preview), [`PlusButton.h`](https://github.com/daik0t/qt-gui/blob/main/PlusButton.h) (Add button)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Grid editor"]
  node_app["Application setup<br/>[main.cpp]"]
  node_grid["Grid editing<br/>[main.cpp]"]
  node_plus["Add button<br/>[PlusButton.h]"]
  node_square["Grid square<br/>[Square.h]"]
end

subgraph group_simulation["Border simulation"]
  node_borderdata["Border extraction<br/>[main.cpp]"]
  node_preview["Border preview<br/>[BorderWindow.cpp]"]
end

subgraph group_runtime["Ray runtime"]
  node_ray["Ray simulation<br/>[RayWidget.cpp]"]
end

node_user(("User"))

node_user -->|"launches"| node_app
node_app -->|"initializes"| node_grid
node_app -->|"creates"| node_plus
node_app -->|"creates"| node_square
node_plus -->|"adds square"| node_grid
node_square -->|"deletes square"| node_grid
node_user -->|"edits or resets"| node_grid
node_app -->|"collects borders"| node_borderdata
node_borderdata -->|"passes borders"| node_preview
node_preview -->|"creates; sets obstacles"| node_ray
node_app -->|"opens preview"| node_preview
node_app -->|"sets stop barriers"| node_ray
node_user -->|"starts simulation"| node_app
node_ray -->|"ticks; updates and paints"| node_ray

click node_app "https://github.com/daik0t/qt-gui/blob/main/main.cpp"
click node_grid "https://github.com/daik0t/qt-gui/blob/main/main.cpp"
click node_plus "https://github.com/daik0t/qt-gui/blob/main/PlusButton.h"
click node_square "https://github.com/daik0t/qt-gui/blob/main/Square.h"
click node_borderdata "https://github.com/daik0t/qt-gui/blob/main/main.cpp"
click node_preview "https://github.com/daik0t/qt-gui/blob/main/BorderWindow.cpp"
click node_ray "https://github.com/daik0t/qt-gui/blob/main/RayWidget.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_grid,node_plus,node_square,node_user toneBlue
class node_borderdata,node_preview toneAmber
class node_ray toneMint
```

## Components

### Grid editor

- [Application setup](https://github.com/daik0t/qt-gui/blob/main/main.cpp): `main.cpp`
- [Grid editing](https://github.com/daik0t/qt-gui/blob/main/main.cpp): `main.cpp`
- [Add button](https://github.com/daik0t/qt-gui/blob/main/PlusButton.h): `PlusButton.h`
- [Grid square](https://github.com/daik0t/qt-gui/blob/main/Square.h): `Square.h`

### Border simulation

- [Border extraction](https://github.com/daik0t/qt-gui/blob/main/main.cpp): `main.cpp`
- [Border preview](https://github.com/daik0t/qt-gui/blob/main/BorderWindow.cpp): `BorderWindow.cpp`

### Ray runtime

- [Ray simulation](https://github.com/daik0t/qt-gui/blob/main/RayWidget.cpp): `RayWidget.cpp`

### Other components

- **User**

## Connections

- User → Application setup: launches (evidence: `main.cpp`)
- Application setup → Grid editing: initializes (evidence: `main.cpp`)
- Application setup → Add button: creates (evidence: `main.cpp`)
- Application setup → Grid square: creates (evidence: `main.cpp`)
- Add button → Grid editing: adds square (evidence: `main.cpp`)
- Grid square → Grid editing: deletes square (evidence: `main.cpp`)
- User → Grid editing: edits or resets (evidence: `main.cpp`)
- Application setup → Border extraction: collects borders (evidence: `main.cpp`)
- Border extraction → Border preview: passes borders (evidence: `main.cpp`)
- Border preview → Ray simulation: creates; sets obstacles (evidence: `BorderWindow.cpp`)
- Application setup → Border preview: opens preview (evidence: `main.cpp`)
- Application setup → Ray simulation: sets stop barriers (evidence: `main.cpp`)
- User → Application setup: starts simulation (evidence: `main.cpp`)
- Ray simulation → Ray simulation: ticks; updates and paints (evidence: `RayWidget.cpp`)
