|
QWindowKit
1.5.1.0
Cross-platform window customization framework
|
Tutorials: English tutorial | 简体中文教程
QWindowKit is a cross-platform window customization framework for Qt Widgets and Qt Quick. It helps applications replace the native title bar with a custom title bar while preserving important system behaviors such as window moving, resizing, system menus, and Windows Snap Layout.
The project inherits the core ideas and part of the implementation lineage from wangwenx190 FramelessHelper, with a refactored architecture and a smaller API surface.



| Default | Glass - regular |
|---|---|
| |
| Glass - clear | Glass - regular, rounded |
| |
| Glass - regular, dark tint | Glass - regular, light tint |
| |
| Legacy - dark blur | Legacy - light blur |
| |

| Component | Requirement | Notes |
|---|---|---|
| Qt | 5.12 or later | Qt Core and Gui are required. Widgets and Quick are optional modules. |
| C++ | C++17 or later | Tested with MSVC, GCC, and Clang. |
| CMake | 3.19 or later | CMake 3.20 or later is recommended. |
Recommended Qt versions:
QWindowKit uses Qt private APIs and platform-specific windowing behavior. Older Qt releases may compile but can have known or unknown runtime issues.
Tested compilers:
| Module | Target | Purpose |
|---|---|---|
| Core | QWindowKit::Core | Shared platform window infrastructure. |
| Widgets | QWindowKit::Widgets | Integration for QWidget and QMainWindow. |
| Quick | QWindowKit::Quick | Integration for QQuickWindow and QML Window. |
QWINDOWKIT_BUILD_WIDGETS is enabled by default. QWINDOWKIT_BUILD_QUICK is disabled by default and must be enabled explicitly when you need Qt Quick support.
Clone the repository with submodules:
Configure, build, and install:
qmsetup is required. If CMake cannot find an installed qmsetup package, the bundled submodule is used automatically.
Configure your application with the installed package path:
Widgets application:
Quick application:
QWindowKit can also be added as a CMake subdirectory when it is vendored into your project.
After installing QWindowKit with CMake, include the generated .pri file:
For MSBuild projects, see Visual Studio Guide.
Set Qt::AA_DontCreateNativeWidgetSiblings before constructing QApplication:
Install WidgetWindowAgent on each top-level widget that needs a custom frame:
Register system button roles so that native behaviors such as Windows Snap Layout can work:
Connect button behavior yourself:
Mark interactive controls inside the title bar as hit-test visible:
Areas inside the title bar that are not hit-test visible are treated as draggable window space.
Register the QML types before loading your QML:
Use WindowAgent from QML:
In Qt 6, the import version can be omitted if your QML style allows unversioned imports.
WindowAgentBase::setWindowAttribute() exposes platform-specific features. Unsupported attributes return false.
Windows examples:
dark-mode configures the native Windows appearance; it does not synchronize the application theme used by Qt controls. Applications should set Qt's color scheme when switching their application theme. QStyleHints::colorScheme() is available since Qt 6.5, while setColorScheme() and unsetColorScheme() require Qt 6.8 or later. See Synchronizing Light and Dark Themes in the tutorial.
macOS examples:
See the English tutorial for more complete examples.
QWindowKit relies on Qt private implementation details to provide better frameless behavior. The project may compile with older Qt versions, but unsupported Qt versions can still have runtime issues caused by Qt internals or platform plugins.
Use Qt 5.15.2+ or Qt 6.6.2+ when possible.
Call setup() as early as possible, preferably near the beginning of the top-level window constructor. If you need minimum, maximum, or fixed size constraints, apply them after QWindowKit has been set up.
Do not switch back to the native system frame at runtime. Recreate the window if your application needs to change between native and custom frames.
Do not call QWidget::setWindowFlags() to change window flags after WidgetWindowAgent::setup().
If a child widget uses Qt::WA_NativeWindow, enable Qt::WA_DontCreateNativeAncestors before creating native ancestors.
Fixed-size windows are supported. Avoid maximizing a window with a constrained maximum width or height, because Qt may not report the native maximized geometry correctly.
The Windows 10 top border workaround works for Qt Widgets and for Qt Quick when rendering through OpenGL, D3D11, or D3D12. Vulkan has known limitations.
For Qt Quick with D3D11/D3D12, a white line may appear at the top of the window on some configurations. With Qt 6.7 or later, setting QT_QPA_DISABLE_REDIRECTION_SURFACE=1 before creating QCoreApplication may help. Do not enable that variable for OpenGL or Vulkan.
QWindowKit is licensed under the Apache License 2.0.