Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes sidebar visibility state is incorrect #524

Conversation

SyarifFakhri
Copy link

Hi @githubuser0xFFFF, hope you are doing well 😄. I have a very interesting bug fix. Currently I can see that AutoHideSideBarPrivate::handleViewportEvent and case QEvent::Resize is responsible for hiding the sidebar widgets if any of the sidebar widgets are hidden (e.g. during view toggle - disable). Since this depends on the Size < TabSize, this can sometimes be incorrect during certain scenarios.

There are two scenarios this bug comes about. The first scenario is more easily reproducible, while the second one unfortunately I can only reproduce in our application - not in any of the demo applications.

Here's how to reproduce the first scenario:

  1. Have a small side tab be the first widget, and a larger side tab to be the second widget. It's easiest to do this if you have one widget have an icon and the other widget without an icon.
  2. Hide the first widget, then the second widget.
  3. the sidebar will not be hidden

side_tab_bug

The second scenario occurs only during application startup. During that time, before first shown, it seems the sizes of the tabs and of the sidebar are incorrect (likely because layout calculations have not run yet), causing it to be hidden even when there are side tab widgets.

The fix is simple, instead of using resize to hide widgets, I simply hook on to the auto hide tab widget itself being hidden and hide the side bar if there are no more visible auto hide tabs. Let me know if this covers all the cases, thanks!

Previously, the resize event of the side bar was used to determine if
the side bar should be hidden or not. Smaller side bar means there's no
visible side tabs so it would be hidden. This assumption breaks during
startup, when the size of the side bar or tabs is not valid yet.
@githubuser0xFFFF
Copy link
Owner

Thank you for this pull request. I merged it with some small changes

jonjenssen pushed a commit to CeetronSolutions/qtadvanceddocking that referenced this pull request Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants