feat: Align left sidebar with vertical stylus palette#1496
Conversation
- Add an optional left offset for the for the left dock palette - Position the sidebar tab next to the vertical stylus palette - Update the offset when the stylus palette changes orientation or visibility - Keep the existing behavior unchanged for horizontal stylus palette
- Remove the gap variable - Return button size to the original size (42)
abdna94
left a comment
There was a problem hiding this comment.
Looks like a great feature! Just a tiny typo in the PR description's first bullet point, "the" is repeated twice. Other than that, the commits and description look really clean!?
|
I don't feel like this is the right solution. For me, the left dock should close with the board frame, and the stylus palette (that's free to move anyway) should adjust to the dock and be kept "inside" the board. Thus, the stylus bar should adjust to the dock, not the other way around. On the commits, the Last note, though it doesn't matter much since the comment got removed; comments should be in English. |
|
@abdna94 You can ping your teammates, or ask them yourself. I don't think actively waiting will achieve much. Nevertheless, I'm interested in the considerations and the reasoning behind the decision. I like to add them into my commit messages, so others can follow my thought process. Oftentimes, this is also useful for later, when issues occur or better solutions might arrive. Even if sometimes, especially for graphical changes, it requires running the code to get a good understanding of its behaviour. |
|
@Vekhir Thanks for the detailed feedback! My initial reasoning for this approach was based on the wording of #1483. I understood the requested behavior as keeping the stylus palette in its current left-side position and opening the sidebar next to it, so that the stylus palette no longer overlaps the sidebar. I agree with you, that keeping the dock/sidebar layout as the stable element and moving or offsetting the vertical stylus palette when the left sidebar is opened seems like the better solution. Before reworking the implementation, I just want to clarify which behavior would be preferred: should the vertical stylus palette be moved/offset when the left sidebar is opened, or would the alternative mentioned in the issue (automatically hiding the stylus palette while the sidebar is open) be the better approach? |
This is the preferred behaviour for me. It keeps the full functionality available. It's also consistent with how the stylus palette behaves with respect to the toolbar when the latter is moved to the bottom. If desired, the stylus palette can always be manually hidden. |
Revert the previous approach that offset the left sidebar based on the stylus palette position. The sidebar should remain anchored to the window edge, because it behaves like a fixed panel and should not be moved by a floating palette. Instead, offset the vertical stylus palette based on the left sidebar tab an opened sidebar geometry. This keeps the sidebar open button accessible while the sidebar is collapsed, and moves the stylus palette beside the opened sidebar when the sidebar is expanded. Horizontal stylus palette behavior remains unchanged. This reverts commit 98419fa. Signed-off-by: claas998
Vekhir
left a comment
There was a problem hiding this comment.
Looks good! A few minor questions arose, the general behaviour is what I expected.
| int offset = mLeftPalette->x() + mLeftPalette->width(); | ||
|
|
||
| const QRect tabRect = mLeftPalette->getTabPaletteRect(); | ||
|
|
||
| if(!tabRect.isNull()) | ||
| offset = qMax(offset, tabRect.x() + tabRect.width()); |
There was a problem hiding this comment.
Doesn't mLeftPalette->x() and mLeftPalette->width() include tabRect?
I'd have thought qMax(offset, tabRect.x() + tabRect.width()) == offset
| if(!mLeftPalette->isVisible()) | ||
| return 0; |
There was a problem hiding this comment.
Does this actually trigger when the left dock is closed? It seems that even if closed, the palette size is taken into account, creating an unnecessary gap.
| connect(mLeftPalette, SIGNAL(pageSelectionChangedRequired()), | ||
| this, SLOT(updateStylusPalettePosition())); |
There was a problem hiding this comment.
This is a nice idea.
To expand on that, maybe a separate signal could be used instead of pageSelectionChangedRequired that could be fired during UBTabDockPalette::mouseMoveEvent to provide a smoother change and adapt the stylus palette immediately. At the moment, it only updates at the end, when the mouse is released.
|
|
||
| if(UBSettings::settings()->appToolBarOrientationVertical->get().toBool()){ | ||
| int posX = border(); | ||
| int posX = qMax(border(), verticalLeftOffset); |
There was a problem hiding this comment.
I think adding them instead of using qMax is better, as that would create a slight separation to the left dock palette. When the palette is at the bottom, it also has that separation for easier distinction.
|
Hi, this is mostly what I had in mind, thanks! |
Base the vertical stylus palette offset only on the expanded left sidebar width instead of the sidebar tab. This removes the extra gap while the sidebar is collapsed, but still keeps the stylus palette next to the sidebar when it is expanded. Add a dedicated dock geometry signal so the stylus palette updates continously while the sidebar is resized. Signed-off-by: claas998
|
Thanks for the review comments. I adjusted the offset calculation so the stylus palette is now only shifted based on the actual expanded left sidebar width, not the sidebar tab/handle. This removes the extra gap when the sidebar is collapsed and also avoids aligning the stylus palette to the handle instead of the sidebar itself. I also changed the positioning to keep a small border between the expanded sidebar and the stylus palette, and added a dedicated dock geometry signal so the stylus palette updates continuously while the sidebar is resized, instead of relying on the page selection signal. I did not extend this to the right pane for now, since this PR is focused on the left sidebar / vertical stylus palette behavior. I think that would be better handled separately if needed. |
Closes #1483
References: #1483
Signed-off-by: claas998, baetjer, SofianElmotiem