# rattle99/qtnotepad architecture

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

- Interactive diagram: https://gitdiagram.com/rattle99/qtnotepad
- Repository: https://github.com/rattle99/qtnotepad

## Overview

QtNotepad is a small Qt5 desktop text editor. The user opens the application into a single main window, then uses its actions to create or edit text, open and save files, print, and perform clipboard or undo/redo operations. The sampled implementation puts these handlers in MainWindow rather than separate domain modules. The README documents the user-facing capabilities; the graph shows those operations without inferring an unsampled internal UI wiring layer.

Main entry points: [`QtNotepad/mainwindow.cpp`](https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.cpp) (Main window), [`QtNotepad/main.cpp`](https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/main.cpp) (Application entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_entry["Application entry<br/>[main.cpp]"]
  node_window["Main window<br/>[mainwindow.cpp]"]
  node_form["Window form<br/>[mainwindow.ui]"]
end

subgraph group_documents["Document operations"]
  node_editor["Text editor<br/>[mainwindow.cpp]"]
  node_file_open["Open file<br/>[mainwindow.cpp]"]
  node_file_save["Save file<br/>[mainwindow.cpp]"]
  node_printing["Print document<br/>[mainwindow.cpp]"]
  node_edit_history["Undo and redo<br/>[mainwindow.cpp]"]
end

subgraph group_platform["Desktop services"]
  node_printer{{"Printer"}}
  node_clipboard{{"Clipboard"}}
end

node_user(("User"))

node_user -->|"launches"| node_entry
node_entry -->|"creates"| node_window
node_user -->|"uses actions"| node_window
node_window -->|"sets up"| node_editor
node_window -->|"handles open"| node_file_open
node_file_open -->|"loads text"| node_editor
node_window -->|"handles save"| node_file_save
node_file_save -->|"reads text"| node_editor
node_window -->|"handles print"| node_printing
node_printing -->|"prints text"| node_editor
node_printing -->|"opens dialog"| node_printer
node_window -->|"copy paste cut"| node_clipboard
node_window -->|"handles undo redo"| node_edit_history
node_edit_history -->|"edits history"| node_editor

click node_entry "https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/main.cpp"
click node_window "https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.cpp"
click node_form "https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.ui"
click node_editor "https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.cpp"
click node_file_open "https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.cpp"
click node_file_save "https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.cpp"
click node_printing "https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.cpp"
click node_edit_history "https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.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_entry,node_window,node_form,node_user toneBlue
class node_editor,node_file_open,node_file_save,node_printing,node_edit_history toneAmber
class node_printer,node_clipboard toneMint
```

## Components

### Application runtime

- [Application entry](https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/main.cpp): `QtNotepad/main.cpp`
- [Main window](https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.cpp): `QtNotepad/mainwindow.cpp`
- [Window form](https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.ui): `QtNotepad/mainwindow.ui`

### Document operations

- [Text editor](https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.cpp): `QtNotepad/mainwindow.cpp`
- [Open file](https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.cpp): `QtNotepad/mainwindow.cpp`
- [Save file](https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.cpp): `QtNotepad/mainwindow.cpp`
- [Print document](https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.cpp): `QtNotepad/mainwindow.cpp`
- [Undo and redo](https://github.com/rattle99/qtnotepad/blob/master/QtNotepad/mainwindow.cpp): `QtNotepad/mainwindow.cpp`

### Desktop services

- **Printer**
- **Clipboard**

### Other components

- **User**

## Connections

- User → Application entry: launches (evidence: `README.md`)
- Application entry → Main window: creates (evidence: `QtNotepad/main.cpp`)
- User → Main window: uses actions (evidence: `README.md`)
- Main window → Text editor: sets up (evidence: `QtNotepad/mainwindow.cpp`)
- Main window → Open file: handles open (evidence: `QtNotepad/mainwindow.cpp`)
- Open file → Text editor: loads text (evidence: `QtNotepad/mainwindow.cpp`)
- Main window → Save file: handles save (evidence: `QtNotepad/mainwindow.cpp`)
- Save file → Text editor: reads text (evidence: `QtNotepad/mainwindow.cpp`)
- Main window → Print document: handles print (evidence: `QtNotepad/mainwindow.cpp`)
- Print document → Text editor: prints text (evidence: `QtNotepad/mainwindow.cpp`)
- Print document → Printer: opens dialog (evidence: `QtNotepad/mainwindow.cpp`)
- Main window → Clipboard: copy paste cut (evidence: `QtNotepad/mainwindow.cpp`)
- Main window → Undo and redo: handles undo redo (evidence: `QtNotepad/mainwindow.cpp`)
- Undo and redo → Text editor: edits history (evidence: `QtNotepad/mainwindow.cpp`)
