┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugene Popov <[email protected]>2021-07-11 21:12:16 +0300
committerNate Graham <[email protected]>2021-07-24 03:30:51 +0000
commit90699c2c2dc6927c8294965041e45c6b986dceff (patch)
tree83a4cf3eb08c467f05f7a16c7246cb01746322ea /src
parent3fe971e17467e30ba59ca42a53931a273fd7e78b (diff)
[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 (cherry picked from commit deaf5916f2f87d78825f33f2ba11475a24c9380f)
Diffstat (limited to 'src')
-rw-r--r--src/panels/places/placesview.cpp11
-rw-r--r--src/panels/places/placesview.h3
2 files changed, 14 insertions, 0 deletions
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 <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());
+}
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