Updated titlebar options and top-level titlebar.

Fixed bugs with SizeFrame. Ensure that the resize does not go past screen/area boundaries. Also ensure that the widget does not jump, by ensuring we have a local and not global rect. We also fixed that if the resize goes below the minimum size values of the widget, we don't drag the widget.

Added top-level titlebar. This has been tested to work on X11 (with numerous workarounds), and has various tricks to set window flags without hiding and re-showing the window.

Fixed bugs with the menu size event. Properly keep the override cursor outside the application boundaries, and handle clicks outside as well. It also limits the resizing to the current MDI area's bounds.

Still need to provide fixes for moving/resizing windows on Wayland.
main
Alex Huszagh 2022-05-07 22:39:19 -05:00
parent 63416c47f7
commit 4733652dd5
3 changed files with 756 additions and 271 deletions

View File

@ -392,7 +392,7 @@ def main():
### Title Bar Customization
The system title bar cannot be customized extensively, since it depends on either the application style or the system theme for how it renders. For a comprehensive example on how to create your own, custom title bar, with fully functional minimize, maximize, shade, unshade, context help, keep above, window title, and a context menu, see [titlebar.py](/example/titlebar.py). This is a drop-in replacement for the title bar on `QMdiSubWindow` which also lets you customize the placement of where the windows minimize to, but could also be modified for `QMainWindow` or `QDialog`.
The system title bar cannot be customized extensively, since it depends on either the application style or the system theme for how it renders. For a comprehensive example on how to create your own, custom title bar, with fully functional minimize, maximize, shade, unshade, context help, keep above, window title, and a context menu, see [titlebar.py](/example/titlebar.py). This is a drop-in replacement for the title bar on `QMdiSubWindow` and `QMaindWindow` which also lets you customize the placement of where the windows minimize to, but could also be modified for `QDialog`.
<img src="/assets/custom_titlebar.png" alt="Custom Title Bar" width="500" height="399"/>

View File

@ -421,8 +421,11 @@ def get_compat_definitions(args):
ns.SubWindow = ns.WindowType.SubWindow
ns.WindowContextHelpButtonHint = ns.WindowType.WindowContextHelpButtonHint
ns.WindowShadeButtonHint = ns.WindowType.WindowShadeButtonHint
ns.BypassWindowManagerHint = ns.WindowType.BypassWindowManagerHint
ns.X11BypassWindowManagerHint = ns.WindowType.X11BypassWindowManagerHint
ns.FramelessWindowHint = ns.WindowType.FramelessWindowHint
ns.WindowStaysOnTopHint = ns.WindowType.WindowStaysOnTopHint
ns.WindowStaysOnBottomHint = ns.WindowType.WindowStaysOnBottomHint
ns.WindowNoState = ns.WindowState.WindowNoState
ns.WindowMinimized = ns.WindowState.WindowMinimized
ns.WindowMaximized = ns.WindowState.WindowMaximized
@ -699,8 +702,11 @@ def get_compat_definitions(args):
ns.SubWindow = QtCore.Qt.SubWindow
ns.WindowContextHelpButtonHint = QtCore.Qt.WindowContextHelpButtonHint
ns.WindowShadeButtonHint = QtCore.Qt.WindowShadeButtonHint
ns.BypassWindowManagerHint = QtCore.Qt.BypassWindowManagerHint
ns.X11BypassWindowManagerHint = QtCore.Qt.X11BypassWindowManagerHint
ns.FramelessWindowHint = QtCore.Qt.FramelessWindowHint
ns.WindowStaysOnTopHint = QtCore.Qt.WindowStaysOnTopHint
ns.WindowStaysOnBottomHint = QtCore.Qt.WindowStaysOnBottomHint
ns.WindowNoState = QtCore.Qt.WindowNoState
ns.WindowMinimized = QtCore.Qt.WindowMinimized
ns.WindowMaximized = QtCore.Qt.WindowMaximized

File diff suppressed because it is too large Load Diff