[Konsole-devel] [Bug 157201] tab names in konsole should have a maximum size
mw_triad at users.sourceforge.net
Thu Jan 21 17:27:16 UTC 2010
--- Comment #19 from Matthew Woehlke <mw_triad users sourceforge net> 2010-01-21 18:27:15 ---
Okay, so you all have made me think about this. The "arbitrary" sizeHint (as I
think is already realized) isn't ideal. Better would be to allow one really
long tab and two short tabs, when they can all fit. Unfortunately doing this is
not very easy.
I think what needs to happen is this: whenever the tabs need to be re-layout
(either resize, addition/removal, or text change), build a list of needed sizes
from the text metrics plus the style metrics for how much larger than the text
the tabs need to be. Add all these up and sort them.
If it is less than the size available, take the smallest one, and make it the
size of the next smallest one, or increase its size so that the sum equals the
available space, whichever is less. Continue this process until the sum is the
available space. (In case of multiple equal-sized tabs at either end of the
list, apply the resize to all of them. This goes for the other branch also.)
If it is more than the available size, take the largest one and make it the
size of the next largest one, or decrease its size so that the sum equals the
available space, whichever is greater. Continue this process until the sum is
the available space. If at any point this would be making a tab smaller than
some determined minimum size, use instead the minimum size and give up (allow
scrolling of the tab bar).
Note that tabs whose text fits are allowed to be smaller than the minimum size.
Also, at the 'give up and allow scrolling' stage, I wonder if maybe it would be
good to allow the tabs to be larger than otherwise to show more of the text, or
if that is still undesirable to maximize the number of visible tabs regardless
That said, don't get me wrong, I am in favor of something along the lines of
the current patch as an improvement on the current situation; let's start with
"better" and work toward "best", not get hung up on "it must be perfect". My
only concern there is that the sizeHint is actually a *max* width and Qt will
still make the tabs smaller as permitted by the text. This seems to be the
intent, but I didn't actually test the patch to verify that it doesn't act as a
minimum size instead (which, as per my previous comment, would be...
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the konsole-devel