Description
RJVB
2016-05-24 16:18:07 UTC
Created attachment 99157 [details]
KDevelop5 (background) and Kate5 (foreground) showing "wrong" and "right" tab bar types when using the native Mac OS X qpa & theme
Created attachment 99158 [details]
OS X Terminal.app preferences dialog showing appropriate use of the tabbar widget
Created attachment 99159 [details]
Xcode preferences window showing the modern tab bar style
Created attachment 99160 [details]
KDevelop5's tabbed document bar using the "wrong" tabbar widget and "lots" of files open. Who's who?
Does this patch do anything? diff --git a/sublime/container.cpp b/sublime/container.cpp index a51c12b..23c89ed 100644 --- a/sublime/container.cpp +++ b/sublime/container.cpp @@ -54,6 +54,8 @@ public: ContainerTabBar(Container* container) : QTabBar(container), m_container(container) { + setDocumentMode(true); + installEventFilter(this); } Patches welcome! Created attachment 100990 [details]
OS X native tab widgets; docmode vs. standard
Switching the tab widget to document mode could be an improvement (that doesn't look that nice, IMHO) as shown here in the demo app from the Oxygen theme.
I've tried this mode in KDevelop a while ago, and from what I remember it actually made things worse, probably because KDevelop does its own things on top of the widget that don't play well with document mode.
I'll try to find some time to test your suggestion, which is surely a different implementation that what I did. Did you check what effect it has under X11?
Has no effect under X11/Breeze afaics. I you use just the oxygen-demo thingy you'll see that there are some subtle changes to the framing of the documents themselves. The tabs don't change, indeed. Created attachment 100996 [details]
lots of native tab widgets in document mode
This is KDevelop using document-mode tab widgets with the proposed patch above, but also using the OS X Integration platform theme plugin which allows to use the fonts, colours and icon theme defined in ~/.config/kdeglobals .
The look is slightly more "normal" for a tabbed document interface (if we ignore the dark colour and the inverted aspect). However, just as with non document mode, the tab bar doesn't get the slider buttons but keeps narrowing the tabs.
In addition, both modes have an additional IMHO unwanted behaviour: they *increase* the window width (rightward growth) when the text starts getting truncated to less than 2 letters. That's what just started happening in this screenshot.
I'm not sure if I mentioned this in my initial report?
Created attachment 100997 [details]
this is how document mode tabwidgets look when they can take their full width
This is without the integration platform plugin, i.e. a pure stock interface.
Created attachment 100998 [details]
standard mode tab widgets in full width, for comparison
Note what looks like a backdrop widget in both modes. Could this be the widget that receives the scroll buttons when using other widget styles, and that gets misaligned?
It wouldn't be possible to force a specific widget style on one particular widget class, perchance? Something like "QTabBar { style : Fusion }" ? Created attachment 100999 [details]
native Macintosh style, document mode, with scroll buttons
diff --git a/sublime/container.cpp b/sublime/container.cpp
index b04f6c3..5ce5f4d 100644
--- a/sublime/container.cpp
+++ b/sublime/container.cpp
@@ -54,6 +54,8 @@ public:
ContainerTabBar(Container* container)
: QTabBar(container), m_container(container)
{
+ setDocumentMode(true);
+ setUsesScrollButtons(true);
installEventFilter(this);
}
Created attachment 101000 [details]
idem, but with elideMode == Qt::ElideNone
diff --git a/sublime/container.cpp b/sublime/container.cpp
index b04f6c3..9fbf931 100644
--- a/sublime/container.cpp
+++ b/sublime/container.cpp
@@ -42,6 +42,8 @@
#include "document.h"
#include <ksqueezedtextlabel.h>
+#include <QDebug>
+
namespace Sublime {
// struct ContainerPrivate
@@ -54,6 +56,9 @@ public:
ContainerTabBar(Container* container)
: QTabBar(container), m_container(container)
{
+ setDocumentMode(true);
+ setUsesScrollButtons(true);
+ setElideMode(Qt::ElideNone);
installEventFilter(this);
}
All the usual widget styles available under X11 and also Fusion default to Qt::ElideNone . Forcing that default causes the scroll buttons to appear earlier because the tab text isn't truncated. (In reply to RJVB from comment #12) > It wouldn't be possible to force a specific widget style on one particular > widget class, perchance? Something like "QTabBar { style : Fusion }" ? In fact it is: ``` diff --git a/sublime/container.cpp b/sublime/container.cpp index b04f6c3..3deb21f 100644 --- a/sublime/container.cpp +++ b/sublime/container.cpp @@ -27,6 +27,7 @@ #include <QMouseEvent> #include <QPointer> #include <QStackedWidget> +#include <QStyleFactory> #include <QStyleOptionTabBarBase> #include <QStylePainter> #include <QTabBar> @@ -54,6 +55,7 @@ public: ContainerTabBar(Container* container) : QTabBar(container), m_container(container) { + setStyle(QStyleFactory::create("fusion")); installEventFilter(this); } ``` Created attachment 101015 [details]
Many tabs with the native Macintosh theme but the Fusion style for the QTabBar widget
I think this may yet be the best solution: just setting the QTabBar style to Fusion for tabbed Sublime documents.
See also the screenshots combining this approach with Breeze and QtCurve.
Created attachment 101016 [details]
Many tabs, Breeze with a Fusion QTabBar
Created attachment 101017 [details]
many tabs, QtCurve with a Fusion QTabBar
I've elaborated the patch a bit and submitted it for review: https://git.reviewboard.kde.org/r/128880/ Git commit 816721d60711b1754053e63e290dba0b205a02eb by Kevin Funk, on behalf of René J.V. Bertin. Committed on 18/10/2016 at 16:21. Pushed by kfunk into branch '5.0'. use a different tab bar widget for tabbed documents This is a potential fix for an issue raised on BKO: https://bugs.kde.org/show_bug.cgi?id=363473 It's also the most complete/implementation: - applies only when the Macintosh widget style is being used - if so, creates a QStyle object for the Fusion widget style - when successful, sets the `Sublime::ContainerTabBar` to use that style This solves all issues stemming from Qt's use of a "native" widget that is intended only for use in dialogs and not in tabbed document interfaces. In my testing, the `ContainerTabBar` ctor is called only rarely, apparently only when changing views (e.g. code -> patch review and back again, or code -> debug). If that observation is correct, use of a global `qTabBarStyle` variable is justified (but more elegant solutions might exist). This observation also justifies (IMHO) the check for the active application style rather than using an `#ifdef Q_OS_OSX` or even applying the fix across all platforms and application styles. That is certainly a possibility that doesn't lead to any shocking style mismatches in my eyes. It does cause some loss of compactness when using my QtCurve settings, which is why I added the style check; a small cost as a gesture to users of a highly configurable style. There is still some weirdness behind the tabs which looks like a misaligned well or frame. I'd love to get that right too. REVIEW: 128880 M +19 -0 sublime/container.cpp http://commits.kde.org/kdevplatform/816721d60711b1754053e63e290dba0b205a02eb |