From: Eugene Popov Date: Sun, 11 Jul 2021 18:12:16 +0000 (+0300) Subject: [PlacesPanel] Remove horizontal scrollbar X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/deaf5916f2f87d78825f33f2ba11475a24c9380f [PlacesPanel] Remove horizontal scrollbar 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 --- diff --git a/src/panels/places/placesview.cpp b/src/panels/places/placesview.cpp index 50446d44d..dc264e411 100644 --- a/src/panels/places/placesview.cpp +++ b/src/panels/places/placesview.cpp @@ -7,10 +7,15 @@ #include "placesview.h" #include "dolphin_placespanelsettings.h" +#include "kitemviews/kitemlistheader.h" + +#include 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()); +} diff --git a/src/panels/places/placesview.h b/src/panels/places/placesview.h index 6005e8b48..86515f56b 100644 --- a/src/panels/places/placesview.h +++ b/src/panels/places/placesview.h @@ -23,6 +23,9 @@ public: void setIconSize(int size); int iconSize() const; + +protected: + void resizeEvent(QGraphicsSceneResizeEvent *event) override; }; #endif