Title Bar API Reference¶
This page provides the API reference for the custom title bar and button controls in qtframelesskit.windows.title_bar.
qtframelesskit.windows.title_bar
¶
Modular title bar package providing custom title bars, buttons, and drag handling.
Exposes the main TitleBar widget, vector control buttons, MenuStyler for Fluent styling, and TitleBarDragHandler for system drag and maximize interactions.
CloseButton
¶
Bases: VectorButton
Window close button with diagonal cross vector glyph and red highlight.
Source code in src/qtframelesskit/windows/title_bar/buttons.py
paintEvent(event)
¶
Paint vector diagonal cross glyph with white stroke on hover/press.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QPaintEvent
|
The paint event. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
FullScreenButton
¶
Bases: VectorButton
Window fullscreen toggle button rendering vector frame glyph.
Source code in src/qtframelesskit/windows/title_bar/buttons.py
paintEvent(event)
¶
Paint vector fullscreen glyph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QPaintEvent
|
The paint event. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
MaximizeButton
¶
Bases: VectorButton
Window maximize and restore button rendering vector rectangles.
Source code in src/qtframelesskit/windows/title_bar/buttons.py
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 | |
isMaximizedState()
¶
Return whether the button displays the restored or maximized glyph.
Returns:
| Type | Description |
|---|---|
bool
|
True if currently displaying restored glyph for a maximized window. |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
paintEvent(event)
¶
Paint vector rectangle or overlapping restore rectangles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QPaintEvent
|
The paint event. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
setMaximizedState(isMaximized)
¶
Update button glyph state to reflect window maximize status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
isMaximized
|
bool
|
True if the parent window is maximized. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
MenuStyler
¶
Styler utility providing Windows 11 Fluent QSS themes for menu bars and popup menus.
Source code in src/qtframelesskit/windows/title_bar/menu_styler.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 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 | |
applyFluentMenuStyle(menuBar, isDark=False, dpi=96)
staticmethod
¶
Apply Fluent design transparent styles and popup menu styling to a menu bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
menuBar
|
QMenuBar
|
Target menu bar instance to style. |
required |
isDark
|
bool
|
True for dark theme palette, False for light theme. Defaults to False. |
False
|
dpi
|
int
|
Screen dots-per-inch used to scale layout padding. Defaults to 96. |
96
|
Source code in src/qtframelesskit/windows/title_bar/menu_styler.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 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 | |
MinimizeButton
¶
Bases: VectorButton
Window minimize button rendering a vector horizontal line glyph.
Source code in src/qtframelesskit/windows/title_bar/buttons.py
paintEvent(event)
¶
Paint vector minimize horizontal line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QPaintEvent
|
The paint event. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
TitleBar
¶
Bases: QWidget
Custom title bar widget with vector control buttons and event filtering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parentWidget
|
QWidget
|
Parent window owning this title bar. |
None
|
hint
|
list of str
|
Button hints controlling which control buttons to display. |
None
|
base_widget
|
QWidget
|
Legacy alias for parentWidget. |
None
|
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
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 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | |
applyFluentMenuStyle(menuBar, isDark=False, dpi=96)
staticmethod
¶
Apply Fluent design transparent styles and popup menu styling to a menu bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
menuBar
|
QMenuBar
|
Target menu bar instance to style. |
required |
isDark
|
bool
|
True for dark theme palette, False for light theme. Defaults to False. |
False
|
dpi
|
int
|
Screen dots-per-inch used to scale layout padding. Defaults to 96. |
96
|
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
eventFilter(watchedObject, event)
¶
Filter parent window state change and layout request events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
watchedObject
|
object
|
The watched Qt object. |
required |
event
|
QEvent
|
The incoming Qt event. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if event was handled, False to pass along. |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
getBackgroundColor()
¶
Return the current background color of the title bar.
Returns:
| Type | Description |
|---|---|
QColor or None
|
Current background color, or None if using default window background. |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
getButtons()
¶
Return mapping of button keys to QPushButton instances.
Returns:
| Type | Description |
|---|---|
dict of str to QPushButton
|
Dictionary of control buttons. |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
getCenterWidget()
¶
Return the custom widget currently hosted in the center area.
Returns:
| Type | Description |
|---|---|
QWidget or None
|
The installed center widget, or None if no widget is installed. |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
getCurrentDpi()
¶
Return the active DPI scaling factor configured for the title bar.
Returns:
| Type | Description |
|---|---|
int
|
Active DPI value (e.g. 96 for 100%, 144 for 150%). |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
getIcon()
¶
Return the QLabel widget displaying window icon.
Returns:
| Type | Description |
|---|---|
QLabel
|
The icon label widget. |
getMaximizeButton()
¶
Return the maximize button instance if present and not hidden.
Returns:
| Type | Description |
|---|---|
MaximizeButton or None
|
The maximize button instance, or None if omitted or hidden. |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
getMenuBar()
¶
Return the installed QMenuBar widget.
Returns:
| Type | Description |
|---|---|
QMenuBar or None
|
The installed menu bar widget, or None if omitted. |
getTitle()
¶
Return the QLabel widget displaying window title.
Returns:
| Type | Description |
|---|---|
QLabel
|
The title label widget. |
getTitleAlignment()
¶
Return the current horizontal alignment flag of the window title.
Returns:
| Type | Description |
|---|---|
AlignmentFlag
|
Active title alignment flag. |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
isAutoStyleMenuBar()
¶
Return whether automatic theme styling is applied to the menu bar.
Returns:
| Type | Description |
|---|---|
bool
|
True if auto-styling is enabled, False otherwise. |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
isDarkTheme()
¶
Return whether the title bar is currently configured with dark theme.
Returns:
| Type | Description |
|---|---|
bool
|
True if dark theme is active, False otherwise. |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
isPressToMove()
¶
Return whether pressing title bar initiates window movement.
Returns:
| Type | Description |
|---|---|
bool
|
True if press to move is enabled. |
mouseDoubleClickEvent(event)
¶
Toggle maximize state upon double-clicking the title bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QMouseEvent
|
Mouse double-click event. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
mousePressEvent(event)
¶
Start native system window drag when left clicking the title bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QMouseEvent
|
Mouse press event. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
paintEvent(event)
¶
Paint title bar background directly using QPainter without stylesheets.
Uses CompositionMode_Source so transparent or custom background colors overwrite the backing store buffer cleanly without alpha-blending over previous frames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QPaintEvent
|
The paint event. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
removeCenterWidget()
¶
Remove and return the hosted center widget without destroying it.
Returns:
| Type | Description |
|---|---|
QWidget or None
|
The removed widget, or None if no center widget was installed. |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
removeMenuBar()
¶
Detach from layout, reparent to None, and return the menu bar.
Returns:
| Type | Description |
|---|---|
QMenuBar or None
|
The detached menu bar widget, or None if no menu bar was installed. |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
setAutoStyleMenuBar(autoStyle)
¶
Configure whether automatic theme styling is applied to the menu bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
autoStyle
|
bool
|
True to automatically update menu bar styling on theme changes. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
setBackgroundColor(color)
¶
Set the background color of the title bar and request a repaint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
QColor, str, or None
|
New background color representation, or None to use default window background. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
setBaseWindowResizable(resizable)
¶
Configure whether maximize button is enabled based on resizability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resizable
|
bool
|
True if the base window can be resized/maximized. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
setCenterWidget(widget)
¶
Install or replace the custom widget hosted in the center area.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget
|
QWidget or None
|
Custom widget to place inside the center area, or None to clear. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
setDarkTheme(isDark)
¶
Configure dark or light theme styling on labels and vector buttons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
isDark
|
bool
|
True to apply dark theme styles, False for light theme. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
setIcon(icon)
¶
Set the window icon on the title bar with default 18x18 size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
QIcon
|
Icon to display. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
setIconSize(width, height)
¶
Set the icon pixel dimensions and adjust button heights.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
int
|
Target icon width in pixels. |
required |
height
|
int
|
Target icon height in pixels. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
setMenuBar(menuBar)
¶
Install or replace the QMenuBar inside the title bar right after the icon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
menuBar
|
QMenuBar or None
|
Menu bar instance to install, or None to remove the existing one. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
setPressToMove(enabled)
¶
Enable or disable dragging window from title bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
True to enable press-to-move dragging. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
setTitle(title)
¶
Set the window title text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Title string to display. |
required |
setTitleAlignment(alignment)
¶
Set the horizontal alignment of the window title.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alignment
|
AlignmentFlag
|
Target alignment flag (e.g. Qt.AlignmentFlag.AlignCenter or Qt.AlignmentFlag.AlignLeft). |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
setTitleBarFont(font)
¶
Set the title label font and scale button heights proportionally.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
font
|
QFont
|
Font to apply to the title text. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
setTitleBarHint(hint)
¶
Show only the control buttons specified in hint list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hint
|
list of str or None
|
Button keys to display ('min', 'max', 'close', 'full_screen'). Defaults to standard set ('min', 'max', 'close') when None. |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
updateDpiScaling(dpi)
¶
Recalculate layout margins, button bounds, icon, and title font for new DPI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dpi
|
int
|
Active dots-per-inch scaling factor (e.g. 96 for 100%, 144 for 150%). |
required |
Source code in src/qtframelesskit/windows/title_bar/title_bar.py
TitleBarDragHandler
¶
Handles native window dragging and maximize toggling via mouse interactions.
Source code in src/qtframelesskit/windows/title_bar/drag_handler.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 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 | |
__init__(titleBar)
¶
Initialize drag handler associated with a title bar instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
titleBar
|
TitleBar
|
The parent TitleBar instance to manage mouse dragging and double clicks for. |
required |
Source code in src/qtframelesskit/windows/title_bar/drag_handler.py
handleMouseDoubleClick(event)
¶
Handle mouse double-click event to toggle window maximized state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QMouseEvent
|
The mouse double-click event. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if double click was handled and window maximized or restored, False otherwise. |
Source code in src/qtframelesskit/windows/title_bar/drag_handler.py
handleMousePress(event)
¶
Handle mouse press event on title bar to initiate system window drag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QMouseEvent
|
The mouse press event. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if system move was initiated and the event accepted, False otherwise. |
Source code in src/qtframelesskit/windows/title_bar/drag_handler.py
isInteractiveChild(childWidget, clickPosition)
¶
Determine whether a child widget or click position represents an interactive element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
childWidget
|
QWidget or None
|
The child widget at the interaction position. |
required |
clickPosition
|
QPoint
|
The position of the mouse interaction in title bar coordinates. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the child widget is an interactive center widget or menu bar, False otherwise. |
Source code in src/qtframelesskit/windows/title_bar/drag_handler.py
isMenuBarClick(clickPosition, targetChild)
¶
Determine whether a click position or child widget belongs to the integrated menu bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
clickPosition
|
QPoint
|
The position of the mouse click in title bar coordinates. |
required |
targetChild
|
QWidget or None
|
The child widget located at the click position, or None if none. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the click targets the menu bar or one of its child widgets, False otherwise. |
Source code in src/qtframelesskit/windows/title_bar/drag_handler.py
VectorButton
¶
Bases: QPushButton
Base QPushButton subclass rendering crisp vector shapes via QPainter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
Parent widget holding this button. |
None
|
Source code in src/qtframelesskit/windows/title_bar/buttons.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 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 | |
enterEvent(event)
¶
Handle mouse enter event and trigger background hover transition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QEvent
|
Mouse enter event. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
getCurrentBackgroundColor()
¶
Return the current interpolated background color.
Returns:
| Type | Description |
|---|---|
QColor
|
Current background color. |
getGlyphColor()
¶
Return the normal stroke color of the vector glyph.
Returns:
| Type | Description |
|---|---|
QColor
|
Current stroke color. |
getGlyphScaleFactor()
¶
Return a subtle scaling factor for vector glyphs relative to base height.
Dampens scaling so glyph symbols only grow slightly at high DPI rather than scaling linearly with button height (e.g. 1.25x at 200% scaling).
Returns:
| Type | Description |
|---|---|
float
|
Dampened scale multiplier where 1.0 corresponds to standard 30px height. |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
getHoverColor()
¶
Return the effective background color applied when hovered.
Returns:
| Type | Description |
|---|---|
QColor
|
Current hover color. |
getPressedColor()
¶
Return the effective background color applied when pressed down.
Returns:
| Type | Description |
|---|---|
QColor
|
Current pressed color. |
isHovered()
¶
Return whether the button is in a hovered visual state.
Returns:
| Type | Description |
|---|---|
bool
|
True if hovered directly or via non-client messages, False otherwise. |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
isPressedState()
¶
Return whether the button is in a pressed visual state.
Returns:
| Type | Description |
|---|---|
bool
|
True if pressed directly or via non-client messages, False otherwise. |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
leaveEvent(event)
¶
Handle mouse leave event and trigger background restore transition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QEvent
|
Mouse leave event. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
mousePressEvent(event)
¶
Handle mouse press event and trigger background pressed transition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QMouseEvent
|
Mouse press event. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
mouseReleaseEvent(event)
¶
Handle mouse release event and transition to hover or idle color.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QMouseEvent
|
Mouse release event. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
paintEvent(event)
¶
Paint button background directly using QPainter without native chrome.
Leaves idle buttons completely transparent so parent window or title bar backgrounds show through cleanly, only rendering hover or pressed fill when the background color has positive alpha.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QPaintEvent
|
The paint event. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
setDarkTheme(isDark)
¶
Update button stroke and hover background styles for dark mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
isDark
|
bool
|
True to apply dark theme styles, False for light theme. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
setGlyphColor(color)
¶
Set the normal stroke color for the vector glyph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
QColor
|
New stroke color for the glyph. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
setHoverColor(color)
¶
Configure a custom hover background color.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
QColor, str, or None
|
Custom hover color, or None to revert to theme default. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
setHoverState(hovered)
¶
Set the hover visual state when handling non-client messages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hovered
|
bool
|
True to show hover styling, False to clear. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
setPressedColor(color)
¶
Configure a custom pressed background color.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
QColor, str, or None
|
Custom pressed color, or None to revert to theme default. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
setPressedState(pressed)
¶
Set the pressed visual state when handling non-client mouse click messages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pressed
|
bool
|
True to show pressed styling, False to clear. |
required |
Source code in src/qtframelesskit/windows/title_bar/buttons.py
updateButtonHeight(newHeight)
¶
Update button height maintaining proportional width.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
newHeight
|
int
|
New button height in pixels. |
required |