TabBar

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: TabBar

Post by triplus »

pablogil wrote:Really nice addition and work!

I have successfully tested it on Mac, here you have the install folder:
OSX - Mac:

Code: Select all

/Users/user_name/Library/Preferences/FreeCAD/Mod/TabBar
Thanks.
could you include a unique class name at the higher QT object (I guess QDockWidget) so that I'm able to style its content without interfering the other styles?
You can use ID selector TabBar (QDockWidget).
is is possible to hide the default one and use only yours?
Toolbars?

Yes it's possible but it takes a bit of work as you need to repeat View -> Toolbars -> Individual Toolbar On/Off control. I don't plan to enforce TabBar as one mode as different users can figure out for themselves what combination works best for them. I plan to provide option to make it easier for user to control Toolbars On/Off state. There are 2 toolbars in Arch/Draft and 2 in PCB WB that override FreeCAD toolbar mechanism and i am not sure yet on how i will support this as i didn't look for solutions yet.
I think all the preference stuff should be into the FreeCAD Preferences
It could happen but not ATM. There is conceptual difference as FreeCAD Preferences workflow is to set the settings and after press Apply/OK. In TabBar i choosed to apply settings on the fly for user to preview the changes as they are applied. And ATM time is better spent on adding features but once this gets done i can explore this scenario to see if it makes sense or not.
DeepSOIC wrote:I just installed it, and it's looking much better than the last time I did that :D Awesome progress!
Thanks.
how do I "lock" the tabbar when the buttons on tabbar are cropped off by window height made small (I just plan to use it as a quick workbench selector)
What will happen next is back to the drawing board and prototyping and after turn that in release material. Therefore this will take time. But once done TabBar should support 2 additional modes. One of them is intended for such use cases.
is it possible to set, what workbenches are shown on tabbar? Note that I would still want to have all workbenches listed in standard workbench selector
Yes as you figured it out. Customizing default Workbench Switcher (Tools -> Customize... -> Workbenches) should be reflected on TabBar.
tabs are draggable, which is nice. But the order I arrange them does not seem to be preserved after I close and reopen FreeCAD
The rationale was user will set preferred (Tools -> Customize... -> Workbenches) order and that is what you get when the session starts. Sometimes user intends to do more task by using 2 workbenches and the tabs are far apart and there should be possibility to temporarily move the tab to different place. This will stay like this for a while but in the future i probably will add additional options.
DeepSOIC wrote:Reodreded workbenches in FreeCAD customization, then reached the settings button on tabbar by keyboard, and locked it :twisted:
Might i suggest slightly different approach:
Docked.png
Docked.png (47.68 KiB) Viewed 2544 times
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: TabBar

Post by DeepSOIC »

triplus wrote:Might i suggest slightly different approach:
Oh, that's much better ;) thanks!
User avatar
pablogil
Posts: 882
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: TabBar

Post by pablogil »

Thank you very much for your answers. I have just started playing with the styles =)

Other question: is it possible to place the TabBar above the default ToolBar? it would have sense to place it there...
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: TabBar

Post by triplus »

DeepSOIC wrote:
triplus wrote:Might i suggest slightly different approach:
Oh, that's much better ;) thanks!
You're welcome.
pablogil wrote:Thank you very much for your answers. I have just started playing with the styles =)
A note on styles. I will add additional control for tab/icon size but not for padding as that messes with platform specific look and feel. Therefore for padding user will need to apply style(sheet) manually if needed. Or to use your themes that i guess will have good support. ;)

Investigating alternative approaches won't be done in near future.
Other question: is it possible to place the TabBar above the default ToolBar? it would have sense to place it there...
I haven't investigate this in depth but i lean more to the answer no.
User avatar
pablogil
Posts: 882
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: TabBar

Post by pablogil »

Thanks again for your answers.

About the styles, I'm just playing with them... I also understand on the time being TabBar is a "3rd party widget" so my styles should not have any styles that affect it but maybe you can think about a way that TabBar loads its own stylesheet so that it can be freely styled (and, of course, combined with FreeCAD styles)
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: TabBar

Post by triplus »

Yes there is possibility styles will be a part of TabBar someday in the future but not in near future. Actually that is true up to a point as ATM i use style sheet to define TabBar look and feel as by default without it TabBar would look/behave a bit different. In the future this could be done in writing custom layout or other approach but for now this is how it will be done.

Therefore from default style point of view i try to introduce the changes only when needed and usually user is/will be able to have more control in Preferences over it.

For example one of my early prototypes included tiles by default:
Example Style.png
Example Style.png (59.33 KiB) Viewed 2504 times
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: TabBar

Post by triplus »

What i am thinking of exploring is to dynamically apply StyleSheet for tool buttons of different sizes. Therefore this ATM mostly applies to tool buttons with menu. Lets say i will support button size from 16 to 64 and tool button with menu need to stay in grid at all sizes but it can have for example different padding/margin to improve menu button experience. As at size 16 and 32 different style might make sense from usability point of view. Adding transparent border to move menu button inside tool button should probably be used for this task.

Therefore if you have some ideas on this (default paddings/margins and neutral style at different sizes) for tool buttons with menu (different types) i could reuse that directly. Note that arrow appearance will probably be left up to the platform FreeCAD runs on.
User avatar
pablogil
Posts: 882
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: TabBar

Post by pablogil »

I would design it as follows:
  • regular buttons with X margin to its right
  • buttons with menu with X width to the dropdown button
I don't know if you remember about it but you have already helped me to partially solve this "issue" on this topic (problem number 11.) (it worked for regular menu buttons but the "undo/redo" ones), it allow me to style it like the following:
QToolButton_menu_v01.png
QToolButton_menu_v01.png (28.61 KiB) Viewed 2472 times
Anyway, I agree with you that the TabBar design should work with the chosen stylesheet applied (or the OS default one).

Some new suggestions:
  • I like the idea to place the TabBar preference button at the same level of the Workbenches tabs:
Example Style_preferences.png
Example Style_preferences.png (85.94 KiB) Viewed 2472 times
  • move "lock" and tabs orientation options as a new tab of TabBar preferences popup window so that you have an unique GUI for preferences
  • you might have applied a negative margin/padding to the QDockWidget so that the QTabBar interferes with the QDockWidget title... even if you "lock" it it cuts the tabs:
screenshot.png
screenshot.png (189.63 KiB) Viewed 2472 times
  • finally, as you see in the previous screenshot it works great and it's so useful. I would love to have the option to place it above the toolbar (or have the general Preferences option to use the "default toolbuttons + workbench selector" or your new TabBar system... but this solution needs it to be merged with FreeCAD and not exists as a standalone widget, anyway, you have my vote for going to master, hehehe)
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: TabBar

Post by triplus »

Just a quick note i will give more feedback over the weekend as currently i am a bit limited by time.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: TabBar

Post by triplus »

pablogil wrote:I like the idea to place the TabBar preference button at the same level of the Workbenches tabs:
Yes that was the original idea but it turned out Qt only supports top/bottom use case reliably. Therefore in the end i choose the approach that should work consistently in all scenarios for now. I will probably investigate this more in the future (but a lot of effort was put into this already).
move "lock" and tabs orientation options as a new tab of TabBar preferences popup window so that you have an unique GUI for preferences
Current solution provides possibility of previewing the changes in TabBar. Therefore if i move the settings inside the TabBar this would need to be done in such way. Rethinking this takes time and therefore this won't happen soon. But it could be done in the future.
you might have applied a negative margin/padding to the QDockWidget so that the QTabBar interferes with the QDockWidget title... even if you "lock" it it cuts the tabs:
I didn't set any style but this might be related:

Code: Select all

widget.tabBar().setDrawBase(False)
Could you try 2 things:
  • Comment out mentioned line and restart FreeCAD
  • Try out system default style.
Does the problem persist?
finally, as you see in the previous screenshot it works great and it's so useful. I would love to have the option to place it above the toolbar (or have the general Preferences option to use the "default toolbuttons + workbench selector" or your new TabBar system...
Well user feedback is valuable and your use case and the one from @DeepSOIC will for sure shift my priorities a bit. That is in next prototyping phase i will put more effort in making TabBar scale better. That is exploring possibilities for providing tabs at main window level and providing workbench buttons on TabBar widget level. And i guess TabBar widget itself will get some improvements but therefore that won't be the only priority. I already did some prototyping and got mixed results and lets see where does that takes us.
but this solution needs it to be merged with FreeCAD and not exists as a standalone widget, anyway, you have my vote for going to master, hehehe)
If something gets build that works and users like it i guess then it will be the time to discuss and evaluate such things.
Post Reply