From 1165a1bc52cdeb2f6538a47c74b34bf283543ba7 Mon Sep 17 00:00:00 2001 From: "K. Cottonears" Date: Thu, 17 Aug 2023 07:22:49 +0000 Subject: [PATCH] Set Maximum Tab Width for folders to Tab bar There is no limit to the width of tabs with the tab bar of the main window. If the directory name is too long, tabs can take up a lot of space and can lead to inconsistent tab widths. To alleviate this, set a maximum tab bar text width of 40 characters for each folder. BUG: 420870 --- src/dolphintabwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp index 03f09ca868..89dd9feba5 100644 --- a/src/dolphintabwidget.cpp +++ b/src/dolphintabwidget.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -507,7 +508,7 @@ QString DolphinTabWidget::tabName(DolphinTabPage *tabPage) const // Make sure that a '&' inside the directory name is displayed correctly // and not misinterpreted as a keyboard shortcut in QTabBar::setTabText() - return name.replace('&', QLatin1String("&&")); + return KStringHandler::rsqueeze(name.replace('&', QLatin1String("&&")), 40 /* default maximum visible folder name visible */); } DolphinViewContainer *DolphinTabWidget::viewContainerAt(DolphinTabWidget::ViewIndex viewIndex) const