Draft
Conversation
* always show the buttons of the toolbar at the right side * at least show one view item for the view (plus the chevron), but if the title is shorter, show more * show as much as possible of the title Issue: #4975
Member
Author
|
@mierin12 I tried to implement (with the help of Claude Code) the layout. But for whatever reason, every once in a while it does not render right - see screenshot. I also did not test on Linux yet. |
Contributor
mierin12
reviewed
Sep 17, 2025
Contributor
There was a problem hiding this comment.
Hello, I made two propositions of change, also visible here (easier to see the green/red intended changes): feature/adaptive_header_layout...mierin12:portfolio:pr-4980-fix
I tried a bit on Windows11, it looks ok to me. :) But Linux I do not know, and there may subtle changes that are hard to see, I did not saw the Payment's toolbar being not centered yesterday for example, only today.
Comment on lines
+112
to
+131
| int y = marginHeight + (availableHeight - actionSize.y) / 2; | ||
|
|
||
| // title at left | ||
| titleLabel.setBounds(marginWidth, y, titleWidth, actionSize.y); | ||
|
|
||
| // Action toolbar at right | ||
| int actionX = bounds.width - marginWidth - actionWidth; | ||
| actionToolbar.setBounds(actionX, y, actionWidth, actionSize.y); | ||
|
|
||
| // View toolbar between title and action toolbar (right-aligned within | ||
| // its space) | ||
| int viewX = actionX - HORIZONTAL_SPACING - viewActualWidth; | ||
| viewToolbarWrapper.setBounds(viewX, marginHeight, viewActualWidth, availableHeight); | ||
|
|
||
| // Update the view toolbar wrapper's layout with the actual available | ||
| // width | ||
| if (viewToolbarWrapper.getLayout() instanceof ToolBarPlusChevronLayout layout) | ||
| { | ||
| layout.setMaxWidth(viewActualWidth); | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| int y = marginHeight + (availableHeight - actionSize.y) / 2; | |
| // title at left | |
| titleLabel.setBounds(marginWidth, y, titleWidth, actionSize.y); | |
| // Action toolbar at right | |
| int actionX = bounds.width - marginWidth - actionWidth; | |
| actionToolbar.setBounds(actionX, y, actionWidth, actionSize.y); | |
| // View toolbar between title and action toolbar (right-aligned within | |
| // its space) | |
| int viewX = actionX - HORIZONTAL_SPACING - viewActualWidth; | |
| viewToolbarWrapper.setBounds(viewX, marginHeight, viewActualWidth, availableHeight); | |
| // Update the view toolbar wrapper's layout with the actual available | |
| // width | |
| if (viewToolbarWrapper.getLayout() instanceof ToolBarPlusChevronLayout layout) | |
| { | |
| layout.setMaxWidth(viewActualWidth); | |
| } | |
| var titleSize = titleLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache); | |
| var viewSize = viewToolbarWrapper.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache); | |
| int yTitle = marginHeight + (availableHeight - titleSize.y) / 2; | |
| int yAction = marginHeight + (availableHeight - actionSize.y) / 2; | |
| int yView = marginHeight + (availableHeight - viewSize.y) / 2; | |
| // title at left | |
| titleLabel.setBounds(marginWidth, yTitle, titleWidth, titleSize.y); | |
| // Action toolbar at right | |
| int actionX = bounds.width - marginWidth - actionWidth; | |
| actionToolbar.setBounds(actionX, yAction, actionWidth, actionSize.y); | |
| // Update the view toolbar wrapper's layout with the actual available | |
| // width | |
| if (viewToolbarWrapper.getLayout() instanceof ToolBarPlusChevronLayout layout) | |
| { | |
| layout.setMaxWidth(viewActualWidth); | |
| } | |
| // View toolbar between title and action toolbar (right-aligned within | |
| // its space) | |
| int viewX = actionX - HORIZONTAL_SPACING - viewActualWidth; | |
| viewToolbarWrapper.setBounds(viewX, yView, viewActualWidth, viewSize.y); |
Contributor
There was a problem hiding this comment.
Proposition :
- for the height, each one of the 3 should to be centered compared to its own height, here actionSize.y was used for more than the action Toolbar, and viewToolbar not centered. I think this fix the "horizontally cut title" and the not centered viewToolBar in Payment.
- create the viewToolBar after setMaxWidth. I think setMaxWidth itselft does not retrigger a layout update.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Issue: #4975