# qt/qtbase architecture

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

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

## Overview

Qt Base is the foundational C++ framework behind Qt applications, providing core types and services, GUI and widget rendering, platform integration, networking, databases, and concurrency. The graph highlights representative runtime paths and preserves major modules named in the source index; the README is empty, and several subsystems are represented by tree paths rather than inspected implementations. Edges are limited to relationships visible in excerpts or source-index references.

Main entry points: [`src/gui/text/qtextengine.cpp`](https://github.com/qt/qtbase/blob/dev/src/gui/text/qtextengine.cpp) (Text layout), [`src/opengl/qopenglengineshadermanager.cpp`](https://github.com/qt/qtbase/blob/dev/src/opengl/qopenglengineshadermanager.cpp) (OpenGL shaders), [`src/gui/text/freetype/qfontengine_ft.cpp`](https://github.com/qt/qtbase/blob/dev/src/gui/text/freetype/qfontengine_ft.cpp) (FreeType fonts), [`src/corelib/thread/qthreadstorage.cpp`](https://github.com/qt/qtbase/blob/dev/src/corelib/thread/qthreadstorage.cpp) (Thread storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core services"]
  node_strings["Strings and values<br/>[qstring.h]"]
  node_files["File APIs<br/>[qfile.h]"]
  node_filesystem["Unix filesystem"]
end

subgraph group_gui["GUI and widgets"]
  node_widgets["Widget API<br/>[qwidget.h]"]
  node_layout["Layout engine<br/>[qlayoutengine.cpp]"]
  node_text_layout["Text layout<br/>[qtextengine.cpp]"]
  node_font_engine["FreeType fonts<br/>[qfontengine_ft.cpp]"]
  node_raster_paint["Raster painting"]
  node_opengl_shaders["OpenGL shaders"]
  node_opengl_source["Shader source"]
  node_graphics_view["Graphics layouts"]
end

subgraph group_platform["Platform integration"]
  node_android_window["Android window<br/>[QtWindow.java]"]
  node_android_drag["Android drag/drop<br/>[QtDragManager.java]"]
  node_android_content["Android content files"]
  node_direct2d["Direct2D painting"]
end

subgraph group_io["I/O and connectivity"]
  node_network_access["Network access"]
  node_socks5["SOCKS5 sockets"]
  node_dbus["D-Bus connections"]
  node_sql["SQL queries<br/>[qsqlquery.cpp]"]
end

subgraph group_runtime["Runtime facilities"]
  node_thread_storage["Thread storage<br/>[qthreadstorage.cpp]"]
  node_threads["Thread APIs<br/>[qthread.h]"]
  node_concurrent["Concurrent engine"]
end

node_qt_app(("Qt application"))

node_files -->|"uses engine"| node_filesystem
node_thread_storage -->|"uses thread data"| node_threads
node_concurrent -->|"uses thread APIs"| node_threads
node_layout -->|"queries widget"| node_widgets
node_text_layout -->|"uses font engine"| node_font_engine
node_text_layout -->|"uses strings"| node_strings
node_font_engine -->|"stores per thread"| node_thread_storage
node_opengl_shaders -->|"uses shader definitions"| node_opengl_source
node_opengl_shaders -->|"uses paint engine"| node_raster_paint
node_android_window -->|"uses drag manager"| node_android_drag

click node_strings "https://github.com/qt/qtbase/blob/dev/src/corelib/text/qstring.h"
click node_files "https://github.com/qt/qtbase/blob/dev/src/corelib/io/qfile.h"
click node_filesystem "https://github.com/qt/qtbase/blob/dev/src/corelib/io/qfilesystemengine_unix.cpp"
click node_thread_storage "https://github.com/qt/qtbase/blob/dev/src/corelib/thread/qthreadstorage.cpp"
click node_threads "https://github.com/qt/qtbase/blob/dev/src/corelib/thread/qthread.h"
click node_concurrent "https://github.com/qt/qtbase/blob/dev/src/concurrent/qtconcurrentthreadengine.cpp"
click node_widgets "https://github.com/qt/qtbase/blob/dev/src/widgets/kernel/qwidget.h"
click node_layout "https://github.com/qt/qtbase/blob/dev/src/widgets/kernel/qlayoutengine.cpp"
click node_text_layout "https://github.com/qt/qtbase/blob/dev/src/gui/text/qtextengine.cpp"
click node_font_engine "https://github.com/qt/qtbase/blob/dev/src/gui/text/freetype/qfontengine_ft.cpp"
click node_raster_paint "https://github.com/qt/qtbase/blob/dev/src/gui/painting/qpaintengine_raster.cpp"
click node_opengl_shaders "https://github.com/qt/qtbase/blob/dev/src/opengl/qopenglengineshadermanager.cpp"
click node_opengl_source "https://github.com/qt/qtbase/blob/dev/src/opengl/qopenglengineshadermanager_p.h"
click node_android_window "https://github.com/qt/qtbase/blob/dev/src/android/jar/src/org/qtproject/qt/android/QtWindow.java"
click node_android_drag "https://github.com/qt/qtbase/blob/dev/src/android/jar/src/org/qtproject/qt/android/QtDragManager.java"
click node_android_content "https://github.com/qt/qtbase/blob/dev/src/plugins/platforms/android/androidcontentfileengine.cpp"
click node_network_access "https://github.com/qt/qtbase/blob/dev/src/network/access/qnetworkaccessmanager.cpp"
click node_socks5 "https://github.com/qt/qtbase/blob/dev/src/network/socket/qsocks5socketengine.cpp"
click node_dbus "https://github.com/qt/qtbase/blob/dev/src/dbus/qdbusconnectionmanager.cpp"
click node_sql "https://github.com/qt/qtbase/blob/dev/src/sql/kernel/qsqlquery.cpp"
click node_graphics_view "https://github.com/qt/qtbase/blob/dev/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h"
click node_direct2d "https://github.com/qt/qtbase/blob/dev/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.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_strings,node_files,node_filesystem toneBlue
class node_widgets,node_layout,node_text_layout,node_font_engine,node_raster_paint,node_opengl_shaders,node_opengl_source,node_graphics_view toneAmber
class node_android_window,node_android_drag,node_android_content,node_direct2d toneMint
class node_network_access,node_socks5,node_dbus,node_sql toneRose
class node_thread_storage,node_threads,node_concurrent,node_qt_app toneIndigo
```

## Components

### Core services

- [Strings and values](https://github.com/qt/qtbase/blob/dev/src/corelib/text/qstring.h): `src/corelib/text/qstring.h`
- [File APIs](https://github.com/qt/qtbase/blob/dev/src/corelib/io/qfile.h): `src/corelib/io/qfile.h`
- [Unix filesystem](https://github.com/qt/qtbase/blob/dev/src/corelib/io/qfilesystemengine_unix.cpp): `src/corelib/io/qfilesystemengine_unix.cpp`

### GUI and widgets

- [Widget API](https://github.com/qt/qtbase/blob/dev/src/widgets/kernel/qwidget.h): `src/widgets/kernel/qwidget.h`
- [Layout engine](https://github.com/qt/qtbase/blob/dev/src/widgets/kernel/qlayoutengine.cpp): `src/widgets/kernel/qlayoutengine.cpp`
- [Text layout](https://github.com/qt/qtbase/blob/dev/src/gui/text/qtextengine.cpp): `src/gui/text/qtextengine.cpp`
- [FreeType fonts](https://github.com/qt/qtbase/blob/dev/src/gui/text/freetype/qfontengine_ft.cpp): `src/gui/text/freetype/qfontengine_ft.cpp`
- [Raster painting](https://github.com/qt/qtbase/blob/dev/src/gui/painting/qpaintengine_raster.cpp): `src/gui/painting/qpaintengine_raster.cpp`
- [OpenGL shaders](https://github.com/qt/qtbase/blob/dev/src/opengl/qopenglengineshadermanager.cpp): `src/opengl/qopenglengineshadermanager.cpp`
- [Shader source](https://github.com/qt/qtbase/blob/dev/src/opengl/qopenglengineshadermanager_p.h): `src/opengl/qopenglengineshadermanager_p.h`
- [Graphics layouts](https://github.com/qt/qtbase/blob/dev/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h): `src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h`

### Platform integration

- [Android window](https://github.com/qt/qtbase/blob/dev/src/android/jar/src/org/qtproject/qt/android/QtWindow.java): `src/android/jar/src/org/qtproject/qt/android/QtWindow.java`
- [Android drag/drop](https://github.com/qt/qtbase/blob/dev/src/android/jar/src/org/qtproject/qt/android/QtDragManager.java): `src/android/jar/src/org/qtproject/qt/android/QtDragManager.java`
- [Android content files](https://github.com/qt/qtbase/blob/dev/src/plugins/platforms/android/androidcontentfileengine.cpp): `src/plugins/platforms/android/androidcontentfileengine.cpp`
- [Direct2D painting](https://github.com/qt/qtbase/blob/dev/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp): `src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp`

### I/O and connectivity

- [Network access](https://github.com/qt/qtbase/blob/dev/src/network/access/qnetworkaccessmanager.cpp): `src/network/access/qnetworkaccessmanager.cpp`
- [SOCKS5 sockets](https://github.com/qt/qtbase/blob/dev/src/network/socket/qsocks5socketengine.cpp): `src/network/socket/qsocks5socketengine.cpp`
- [D-Bus connections](https://github.com/qt/qtbase/blob/dev/src/dbus/qdbusconnectionmanager.cpp): `src/dbus/qdbusconnectionmanager.cpp`
- [SQL queries](https://github.com/qt/qtbase/blob/dev/src/sql/kernel/qsqlquery.cpp): `src/sql/kernel/qsqlquery.cpp`

### Runtime facilities

- [Thread storage](https://github.com/qt/qtbase/blob/dev/src/corelib/thread/qthreadstorage.cpp): `src/corelib/thread/qthreadstorage.cpp`
- [Thread APIs](https://github.com/qt/qtbase/blob/dev/src/corelib/thread/qthread.h): `src/corelib/thread/qthread.h`
- [Concurrent engine](https://github.com/qt/qtbase/blob/dev/src/concurrent/qtconcurrentthreadengine.cpp): `src/concurrent/qtconcurrentthreadengine.cpp`

### Other components

- **Qt application**

## Connections

- File APIs → Unix filesystem: uses engine (evidence: `src/corelib/io/qfilesystemengine_unix.cpp`)
- Thread storage → Thread APIs: uses thread data (evidence: `src/corelib/thread/qthreadstorage.cpp`)
- Concurrent engine → Thread APIs: uses thread APIs (evidence: `src/concurrent/qtconcurrentthreadengine.cpp`)
- Layout engine → Widget API: queries widget (evidence: `src/widgets/kernel/qlayoutengine.cpp`)
- Text layout → FreeType fonts: uses font engine (evidence: `src/gui/text/qtextengine.cpp`)
- Text layout → Strings and values: uses strings (evidence: `src/gui/text/qtextengine.cpp`)
- FreeType fonts → Thread storage: stores per thread (evidence: `src/gui/text/freetype/qfontengine_ft.cpp`)
- OpenGL shaders → Shader source: uses shader definitions (evidence: `src/opengl/qopenglengineshadermanager.cpp`)
- OpenGL shaders → Raster painting: uses paint engine (evidence: `src/opengl/qopenglengineshadermanager.cpp`)
- Android window → Android drag/drop: uses drag manager (evidence: `src/android/jar/src/org/qtproject/qt/android/QtWindow.java`)
