diff options
Diffstat (limited to 'Swift/QtUI/Trellis/QtDNDTabBar.cpp')
-rw-r--r-- | Swift/QtUI/Trellis/QtDNDTabBar.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Swift/QtUI/Trellis/QtDNDTabBar.cpp b/Swift/QtUI/Trellis/QtDNDTabBar.cpp index a6806c6..dbe397b 100644 --- a/Swift/QtUI/Trellis/QtDNDTabBar.cpp +++ b/Swift/QtUI/Trellis/QtDNDTabBar.cpp @@ -8,10 +8,10 @@ #include <cassert> -#include <QMouseEvent> -#include <QDropEvent> #include <QDrag> +#include <QDropEvent> #include <QMimeData> +#include <QMouseEvent> #include <QPainter> #include <QTabWidget> @@ -50,6 +50,18 @@ QSize QtDNDTabBar::sizeHint() const { return hint; } +QSize QtDNDTabBar::tabSizeHint(int index) const { + QSize tabSize = QTabBar::tabSizeHint(index); +#if defined(Q_OS_MAC) + // With multiple tabs having the same label in a QTabBar, the size hint computed by + // Qt on OS X is too small and it is elided even though there is enough horizontal + // space available. We work around this issue by adding the width of a letter to the + // size hint. + tabSize += QSize(QFontMetrics(font()).width("I"), 0); +#endif + return tabSize; +} + void QtDNDTabBar::dragEnterEvent(QDragEnterEvent* dragEnterEvent) { QtDNDTabBar* sourceTabBar = dynamic_cast<QtDNDTabBar*>(dragEnterEvent->source()); if (sourceTabBar) { |