]> cloud.milkyroute.net Git - dolphin.git/commitdiff
[PlacesPanel] Remove horizontal scrollbar
authorEugene Popov <popov895@ukr.net>
Sun, 11 Jul 2021 18:12:16 +0000 (21:12 +0300)
committerNate Graham <nate@kde.org>
Sat, 24 Jul 2021 03:30:51 +0000 (03:30 +0000)
This MR removes the horizontal scrollbar of the Places panel. For titles that don't fit in the panel, their elided versions will be used (i.e., with ...).

BUG: 301758

(cherry picked from commit deaf5916f2f87d78825f33f2ba11475a24c9380f)

src/panels/places/placesview.cpp
src/panels/places/placesview.h

index 50446d44df3bfa60aa12048720df7b520aaaf541..dc264e411f584dbb7b9b381f17cf04a6fbdb87e7 100644 (file)
@@ -7,10 +7,15 @@
 #include "placesview.h"
 
 #include "dolphin_placespanelsettings.h"
+#include "kitemviews/kitemlistheader.h"
+
+#include <QGraphicsSceneResizeEvent>
 
 PlacesView::PlacesView(QGraphicsWidget* parent) :
     KStandardItemListView(parent)
 {
+    header()->setAutomaticColumnResizing(false);
+
     const int iconSize = PlacesPanelSettings::iconSize();
     if (iconSize >= 0) {
         setIconSize(iconSize);
@@ -36,3 +41,9 @@ int PlacesView::iconSize() const
     return option.iconSize;
 }
 
+void PlacesView::resizeEvent(QGraphicsSceneResizeEvent *event)
+{
+    KStandardItemListView::resizeEvent(event);
+
+    header()->setColumnWidth(QByteArrayLiteral("text"), event->newSize().width());
+}
index 6005e8b489d9e4027950db2556a1c583642edb2c..86515f56b3bdb59a791dffd72ac27f3d030a3559 100644 (file)
@@ -23,6 +23,9 @@ public:
 
     void setIconSize(int size);
     int iconSize() const;
+
+protected:
+    void resizeEvent(QGraphicsSceneResizeEvent *event) override;
 };
 
 #endif