this post was submitted on 09 Feb 2025
30 points (100.0% liked)

Python

6628 readers
119 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
 

I'm working on a project that needs lots of toolbars on screen at once, even though not all of them will be used at the same time. So, I'm modelling this 'foldable' dock widget after what I remember Photoshop panels used to be like.

It's a work in progress, but would like to hear constructive suggestions.

https://blocks.programming.dev/0101100101/42c5d67f86c049baa3500aa38e439f8a

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 1 day ago* (last edited 1 day ago) (1 children)

Nice.

Depending upon what you are aiming for, I'd go with a sidebar. Something like this:

Illustrating the idea of widgets in a sidebar

  • (a) The sidebar's horizontal width can be changed, causing all docked widgets in it to resize their width to fit.
  • (b) The docked widgets/sections may resize vertically, either automatically or manually
    • In case of manual resizing of widgets, you might want to add a scroll area in the widget
  • (c) A widget/section may leave empty area in the bottom or vertically expand to fill
  • (d) In case of empty area, the sidebar can either have empty space or be vertically shortened to expose part of the workspace underneath
  • (e) Instead of having just a single widget, you can have a section on the toolbar, with multiple widgets in it. In this case, when the user changes the tab, the section will either automatically resize (vertically) as per widget requirements, or will stay the size that the user set manually, adding a scrollbar in case of overflow or empty area in case of lack of widget content.

This is in contrast to usual sidebars that tend to have a main tab bar, which only allows for a single docked widget to be shown at a time. This will allow the user to stack widgets both vertically and horizontally as per their requirements. A similar example can be seen in the right side panel in the Design Mode of Qt Creator itself.
Folded widgets/sections, when docked, will yield vertical space to other widgets/sections, which will in turn, snap upwards (or you can do downwards if that's your fancy)

Maybe you can also make the floating widgets mergeable into tabs, which will reduce the number of point+click actions in cases where only 1 of 2 widgets is being used.


CC BY-NC-SA 4.0

[–] [email protected] 2 points 1 day ago* (last edited 1 day ago) (1 children)

Qt automatically handles the conversion of QDockWidgets into tabbed docked widgets when one is dragged over an existing one.

I have a little demo video, but I have no idea where to upload it to!

[–] [email protected] 0 points 1 day ago

Oh! You actually used QDockWidget instead of making it from the start. I should have read the code before commenting, I guess.