Summary: | minimum tab width is too wide | ||
---|---|---|---|
Product: | [Applications] konsole | Reporter: | Felix Miata <mrmazda> |
Component: | general | Assignee: | Konsole Developer <konsole-devel> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | alex, chemobejk, des, lecha, michalm, petr, rastos_kdebugs |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | make the QTabBar not expanding |
Description
Felix Miata
2008-07-14 21:34:10 UTC
I'm using Mandriva Cooker (devel) RPMs, not compiling myself. For the record, I think that the empty tab-space unit is left so one can double-click in the open space to open a new tab. I personally wouldn't mind minimum-width tabs, though. I figured how to do it. With Qt 4.5 there is a new property for QTabBar widget which has name "expanding" and defaults to "true". If set to "false" (for example in TabbedViewContainer constructor) you can specify the new width by changing ViewContainerTabBar::tabSizeHint(). All that in in apps/konsole/src/ViewContainer.cpp in kdebase. Now the question is - what is the desired width? Do we want - a fixed width - to fit the text of tab name - to fit the text of tab name with upper limit (perhaps with a tooltip?) - something else The 1st option is easiest - just say the number of pixels. For 2nd and 3rd - I would need to figure out the length of string in pixels based on font ... no idea how difficult is that. (In reply to comment #3) > Now the question is - what is the desired width? Do we want > - a fixed width > - to fit the text of tab name > - to fit the text of tab name with upper limit (perhaps with a tooltip?) > - something else > The 1st option is easiest - just say the number of pixels. For 2nd and 3rd - I > would need to figure out the length of string in pixels based on font ... no > idea how difficult is that. Width in px is not acceptable unless the width in px is derived from the width of the font to be used. How many px are required is double if your desktop DPI is 140 instead of 70. Fit the text with upper limit makes most sense to me. Created attachment 33733 [details] make the QTabBar not expanding In the attachment is a single-line patch that says that the QTabBar used in Konsole is not expanding to fill available space. The patch was created using Slackware-current source code package ftp://ftp.slackware.at/slackware-current/source/kde/src/kdebase-4.2.3.tar.xz Note: there is already a hardcoded limit of 20 characters on the tab's text in TabbedViewContainer::updateTitle(), so it is not necessary to limit the size of the tab width in ViewContainerTabBar::tabSizeHint(). > I would need to figure out the length of string in pixels based on font ... no > idea how difficult is that. It's not difficult (although the answer you get is a "guess", you can only get actual width by rendering the text, but the guess is good enough 90% of the time). I could provide sample code if you like. That said, I prefer the current behavior when things "aren't crowded", but this relates closely to bug 192079 (which I believe is a duplicate, but I don't have an older bug number handy). *** This bug has been confirmed by popular vote. *** In KDE 4.5.x the situation is much worse. So worse in fact that I had to quit using konsole and start using terminate. The problem in current version (konsole 4:4.5.1-0ubuntu1) is that the minimum tab width on the tab bar is so large that I can't open more than 4 or 5 tabs before the tabs have to "scroll". I.e.: they are not visible all together as before. Since I need at least 20 open tabs to work I forcefully had to dump konsole and find an alternative :( Please, pretty please revert to the old behavior on the tab bar! Agree with Alex; having many tabs makes konsole unusable! :-( Me too. Minimum tab width should be reduced at least to what it was in KDE 4.4. Or make it configurable for those of us that use a lot of tabs! #9, #10 - at the time I had to put in a minimum otherwise no scrollbar would appear. It does appear 150 was a bit much. I'll look at it again. Ideally, the tab text should be used to calculate the width. What Konsole version were you getting 20 tabs w/o a scroll bar? What was your tab format? It has worked OK with every konsole version before 4.5. For those tabs I talk about I have replaced the tab format with a fixed (mnemonic) text. I use "Lucida Typewriter 9" (mapped to a bitmap font of 12 pixels @ 75dpi) and a terminal size of 80x25, which leads to a size of 583x380 pixels, at least on the machine I'm typing this. On my Fedora 14 test machine, which is the first one with KDE 4.5, I had been using the same size of konsole previously with 5 tabs and no scrolling. Now 4 tabs already cause tab scrolling. As Stefan: everything worked fine until pre 4.5 release: I renamed my tabs to have a single char so that I could fill the bar with lot of them. This is now not possible anymore so I had to stop using it and thats bothers me very much :( I've changed trunk to have a minimum and max width using stylesheets. setStyleSheet("QTabBar::tab { min-width: 2em; max-width: 25em }"); Comments welcomed. (In reply to comment #14) > I've changed trunk to have a minimum and max width using stylesheets. This seems to work nicely. Tab width is dynamic again and I was able to fit 10 one-letter tabs into my standard konsole window before the scrolling buttons appeared. I'm sorry I've to ask a stupid question since I've no knowledge of QT and stylesheets: do I have to wait for the next point release of KDE or is there a way to fix my current installation? I'm running KDE 4.5.1 under Kubuntu 10.04. Thanks, Alex It's a code change, so you'll have to recompile the kdebase package. The patch can be extracted from SVN revision 1172362: <http://websvn.kde.org/?view=revision&revision=1172362> SVN commit 1173668 by hindenburg: Change the way tab width is determined by using min/max stylesheet. BUG: 166573 BUG: 189847 BUG: 157201 M +3 -21 ViewContainer.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1173668 *** Bug 251295 has been marked as a duplicate of this bug. *** |