Core & Native API Reference¶
This page provides the API reference for the native frame controller and Win32 ctypes types.
Frame Controller¶
qtframelesskit.core.frame_controller
¶
Win32 native window frame message controller.
Encapsulates non-client calculations, border resize hit testing, non-client mouse events, DPI changes, and native window drag delegation.
WindowFrameController
¶
Controller managing native Win32 window frame messages and sizing logic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
QWidget
|
Target top-level window widget. |
required |
borderWidth
|
int
|
Resize border thickness in pixels. |
5
|
resizable
|
bool
|
Whether window resizing is enabled. |
True
|
pressToMove
|
bool
|
Whether press-to-move window dragging is enabled. |
True
|
dpiScaling
|
bool
|
Whether automatic DPI scaling is allowed. |
True
|
Source code in src/qtframelesskit/core/frame_controller.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
getBorderWidth()
¶
Return the resize border thickness in pixels.
Returns:
| Type | Description |
|---|---|
int
|
Border width in pixels. |
handleNativeEvent(eventType, message)
¶
Process native Win32 messages for window framing, sizing, and hit testing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eventType
|
QByteArray or bytes
|
Native event type identifier. |
required |
message
|
int
|
Pointer address to the native Win32 MSG structure. |
required |
Returns:
| Type | Description |
|---|---|
tuple of (bool, int) or None
|
Tuple of (True, result_code) when message is handled, or None when unhandled. |
Source code in src/qtframelesskit/core/frame_controller.py
isDpiScalingAllowed()
¶
Return whether automatic DPI scaling is allowed.
Returns:
| Type | Description |
|---|---|
bool
|
True if automatic DPI scaling is allowed. |
isPressToMove()
¶
Return whether press-to-move dragging is enabled.
Returns:
| Type | Description |
|---|---|
bool
|
True if press-to-move is enabled. |
isResizable()
¶
Return whether the window can be resized.
Returns:
| Type | Description |
|---|---|
bool
|
True if resizing is allowed. |
setBorderWidth(width)
¶
Set the resize border thickness in pixels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
int
|
New border width in pixels. |
required |
Source code in src/qtframelesskit/core/frame_controller.py
setDpiScalingAllowed(allow)
¶
Enable or disable automatic DPI scaling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
allow
|
bool
|
True to allow automatic DPI scaling. |
required |
setPressToMove(enabled)
¶
Enable or disable press-to-move window dragging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
True to enable press-to-move. |
required |
setResizable(resizable)
¶
Set whether the window is resizable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resizable
|
bool
|
True to allow resizing. |
required |
startSystemMove()
¶
Start native system window drag.
Source code in src/qtframelesskit/core/frame_controller.py
Win32 Types¶
qtframelesskit.native.win32_types
¶
ctypes mirrors of Win32 structures used by the frameless window machinery.
All types here map 1-to-1 to their C counterparts in the Windows SDK.
They are consumed by WM_NCCALCSIZE and DWM attribute handlers in
the frameless window implementation.
ACCENT_POLICY
¶
Bases: Structure
ctypes mirror of the Win32 ACCENT_POLICY structure.
Configures window accent attributes such as Acrylic blur behind and tint.
Source code in src/qtframelesskit/native/win32_types.py
ACCENT_STATE
¶
Bases: Enum
Win32 SetWindowCompositionAttribute accent policy states.
Attributes:
| Name | Type | Description |
|---|---|---|
ACCENT_DISABLED |
int
|
Disables composition accent policy. |
ACCENT_ENABLE_GRADIENT |
int
|
Enables solid gradient fill. |
ACCENT_ENABLE_TRANSPARENTGRADIENT |
int
|
Enables translucent gradient fill. |
ACCENT_ENABLE_BLURBEHIND |
int
|
Enables classic Aero blur behind. |
ACCENT_ENABLE_ACRYLICBLURBEHIND |
int
|
Enables modern Fluent Acrylic blur behind. |
ACCENT_ENABLE_HOSTBACKDROP |
int
|
Enables host backdrop blur. |
ACCENT_INVALID_STATE |
int
|
Invalid accent state boundary. |
Source code in src/qtframelesskit/native/win32_types.py
DWMWINDOWATTRIBUTE
¶
Bases: Enum
Subset of the Win32 DWMWINDOWATTRIBUTE enum used by this library.
Passed to DwmSetWindowAttribute to toggle immersive dark mode, corner
rounding preference, border color, and system backdrop materials.
Source code in src/qtframelesskit/native/win32_types.py
DWM_BLURBEHIND
¶
Bases: Structure
ctypes mirror of the Win32 DWM_BLURBEHIND structure.
Passed to DwmEnableBlurBehindWindow to enable desktop window manager blur-behind.
Source code in src/qtframelesskit/native/win32_types.py
DWM_SYSTEMBACKDROP_TYPE
¶
Bases: Enum
Win32 DWM_SYSTEMBACKDROP_TYPE enum values for Windows 11 Build 22621+.
Attributes:
| Name | Type | Description |
|---|---|---|
AUTO |
int
|
System determines backdrop type automatically. |
NONE |
int
|
No backdrop material. |
MAINWINDOW |
int
|
Mica material for main application window. |
TRANSIENTWINDOW |
int
|
Acrylic backdrop material. |
TABBEDWINDOW |
int
|
Mica Alt material for tabbed windows. |
Source code in src/qtframelesskit/native/win32_types.py
MARGINS
¶
Bases: Structure
ctypes mirror of the Win32 MARGINS structure.
Passed to DwmExtendFrameIntoClientArea to control the DWM glass
frame extension on each edge of the window.
Source code in src/qtframelesskit/native/win32_types.py
NCCALCSIZE_PARAMS
¶
Bases: Structure
ctypes mirror of the Win32 NCCALCSIZE_PARAMS structure.
Passed via lParam in WM_NCCALCSIZE when wParam is non-zero.
rgrc[0] holds the proposed new client rect that we adjust to remove
the native title bar from the non-client area calculation.
Source code in src/qtframelesskit/native/win32_types.py
PWINDOWPOS
¶
Bases: Structure
ctypes mirror of the Win32 WINDOWPOS structure.
Embedded inside :class:NCCALCSIZE_PARAMS and passed to
WM_NCCALCSIZE to describe the new window position and size.
Source code in src/qtframelesskit/native/win32_types.py
TRACKMOUSEEVENT
¶
Bases: Structure
ctypes mirror of the Win32 TRACKMOUSEEVENT structure.
Passed to TrackMouseEvent to request non-client mouse leave notifications.
Source code in src/qtframelesskit/native/win32_types.py
WINDOWCOMPOSITIONATTRIBDATA
¶
Bases: Structure
ctypes mirror of the Win32 WINDOWCOMPOSITIONATTRIBDATA structure.
Passed to SetWindowCompositionAttribute to apply accent policies.
Source code in src/qtframelesskit/native/win32_types.py
WindowCornerPreference
¶
Bases: IntEnum
Windows 11 window corner rounding preferences.
Values correspond directly to DWM_WINDOW_CORNER_PREFERENCE constants.
Source code in src/qtframelesskit/native/win32_types.py
WindowEffect
¶
Bases: Enum
Supported native Windows backdrop materials and effects.
Attributes:
| Name | Type | Description |
|---|---|---|
NONE |
int
|
Default solid window background with no backdrop material. |
MICA |
int
|
Windows 11 Mica material matching system theme and desktop wallpaper. |
ACRYLIC |
int
|
Windows 10/11 Acrylic blur-behind material with custom tint. |
MICA_ALT |
int
|
Windows 11 Mica Alt (tabbed) material for secondary surfaces. |
Source code in src/qtframelesskit/native/win32_types.py
colorToColorRef(color)
¶
Convert a QColor or hex string into a Win32 COLORREF integer (0x00BBGGRR).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
QColor or str
|
Color representation to convert. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Win32 COLORREF representation (0x00BBGGRR), or 0xFFFFFFFE (default) if invalid. |