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

Auto hide feature #452

Closed

Conversation

SyarifFakhri
Copy link

  • Added main functionality for auto hiding docks
  • Auto hide toggle button is added in the dock area titlebar
  • Side tab bars are added to the left and right of each window
  • Add config for enabling the auto hide button, left side bar area and the right side bar area
  • Add logic for save state and restore state with the auto hide functionality

Copy link
Owner

@githubuser0xFFFF githubuser0xFFFF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed all build issues that occured when building your pull request on my Windows machine with qmake and pushed everything to a new branch auto_hide_feature

examples/autohide/CMakeLists.txt Show resolved Hide resolved
examples/centralwidget/autohide.pro Outdated Show resolved Hide resolved
examples/autohide/CMakeLists.txt Outdated Show resolved Hide resolved
src/DockContainerWidget.cpp Outdated Show resolved Hide resolved
src/OverlayDockContainer.cpp Outdated Show resolved Hide resolved
src/OverlayDockContainer.cpp Outdated Show resolved Hide resolved
src/SideTabBar.h Outdated Show resolved Hide resolved
src/SideTabBar.cpp Outdated Show resolved Hide resolved
src/DockWidgetSideTab.h Outdated Show resolved Hide resolved
src/DockWidgetSideTab.cpp Outdated Show resolved Hide resolved
@githubuser0xFFFF
Copy link
Owner

githubuser0xFFFF commented Sep 7, 2022

Thank you for this big merge request with a great new feature. I fixed all build issues in your pull request that occured when building everything on Windows with MinGW and qmake.

When I run the demo application on WIndows to test the feature, I can see an issue that I will document in the next days.

@githubuser0xFFFF
Copy link
Owner

The current implementation has a bug, that causes a wrong painting on Windows. To reproduce this, execute the following steps:

  • Start the demo application AdvancedDockingSystemDemo.exe
  • click the pin in the group highlighted in the following picture
    grafik
  • now click the Active X 0 or Label 4 side tab - the sidebar widget is not paintet properly (no title bar)
    grafik
  • if you click the Label 1 side tab, then the sidebar is paintet properly:
    grafik

Because you implemented the feature, it is easier for you to find the problem.

@SyarifFakhri
Copy link
Author

Thanks for reviewing it so quickly! I will merge this with the auto hide branch you created and look into the issues you brought up. Please let me know if you find anything else :). I'm still testing this, so I will post more bug fixes as I go along, will let you know once it's fully ready for review!

@githubuser0xFFFF
Copy link
Owner

@SyarifFakhri Thank you for your contribution. I'm closing the pull request now because development now takes place in the autohide_feature branch.

@FelixBer
Copy link

Just a heads up, QMouseEvent::globalPos is deprecated in Qt6:

https://doc.qt.io/qt-6/qmouseevent-obsolete.html#globalPos

Used twice around

auto pos = mapFromGlobal(me->globalPos());

Also,
#include "DockWidgetTab.h"
#include "DockingStateReader.h"
appear to be unused in AutoHideDockContainer.cpp

@githubuser0xFFFF
Copy link
Owner

@FelixBer Thank you. Fixed it.

@SyarifFakhri
Copy link
Author

SyarifFakhri commented Nov 21, 2022

@githubuser0xFFFF
Just something I noticed while building this:
1.

struct DockContainerWidgetPrivate;

This gives a warning that struct was previously declared as a class

I believe the ImageViewer.cpp and RenderWidget.cpp are missing in this CMakeLists.txt :)

@githubuser0xFFFF
Copy link
Owner

@SyarifFakhri Thank you. Fixed it. Please test.

I have a question. In qmake I can add an RC file on Windows with the RC_FILE statement (see demo.pro RC_FILE += app.rc). Do you know how to add this for a CMake file?

@SyarifFakhri
Copy link
Author

Cheers! It does build now :)

In qmake I can add an RC file on Windows with the RC_FILE statement (see demo.pro RC_FILE += app.rc). Do you know how to add this for a CMake file?

I believe you just need to add it like so:
image

Let me know if that works for you :)

@SyarifFakhri
Copy link
Author

@githubuser0xFFFF I did find one more issue while testing this. If you open an auto hide dock tab and open the context menu as shown:
image

Then click anywhere inside the dock but outside the context menu, the dock will collapse.

I believe that's due to this code here:

if (widget && widget->window() != this->window())

The context menu is considered as a different window, so it closes. I think one fix would be to check if the widget is a descendant of the auto hide widget, and don't collapse it if it is perhaps?

@githubuser0xFFFF
Copy link
Owner

githubuser0xFFFF commented Nov 22, 2022

@SyarifFakhri Thank you - good catch. I changed the implementation now. Now the auto hide container is not closed, if the user clicks into another floating window. It will only get closed in the following cases:

  • user clicks in the same dock container but outside of the auto hide widget
  • user clicks the auto hide tab
  • user starts dragging a floating widget that is not the container of this auto hide widget
  • user starts dragging a docked widget

Please test, if this is ok for you.

@githubuser0xFFFF
Copy link
Owner

@SyarifFakhri I noticed that there are still some things, that needs to get fixed with hiding the auto hide widget

@githubuser0xFFFF
Copy link
Owner

@SyarifFakhri Ok, I think I finally fixed the eventFilter function ion auto hide widget to work properly. Please test.

@SyarifFakhri
Copy link
Author

Everything seems good. Thanks for the fixes!

@yuriyoung
Copy link

how to pin/unpin(auto hide) a group?

@githubuser0xFFFF
Copy link
Owner

@yuriyoung Just read the manual and play around with the demo application and you will find it out in some minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants