From 90699c2c2dc6927c8294965041e45c6b986dceff Mon Sep 17 00:00:00 2001 From: Eugene Popov Date: Sun, 11 Jul 2021 21:12:16 +0300 Subject: [PATCH 1/2] [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) --- src/panels/places/placesview.cpp | 11 +++++++++++ src/panels/places/placesview.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/panels/places/placesview.cpp b/src/panels/places/placesview.cpp index 50446d44df..dc264e411f 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 6005e8b489..86515f56b3 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 From 674a4a91dac8698bdd9aef611e2707d4fb389bf1 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 21 Jul 2021 23:24:32 +0200 Subject: [PATCH 2/2] Add break; to KItemListRoleEditor::keyPressEvent cases --- src/kitemviews/private/kitemlistroleeditor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/kitemviews/private/kitemlistroleeditor.cpp b/src/kitemviews/private/kitemlistroleeditor.cpp index cc10bd58ae..993c6893a9 100644 --- a/src/kitemviews/private/kitemlistroleeditor.cpp +++ b/src/kitemviews/private/kitemlistroleeditor.cpp @@ -90,6 +90,7 @@ void KItemListRoleEditor::keyPressEvent(QKeyEvent* event) event->accept(); return; } + break; case Qt::Key_Backtab: case Qt::Key_Up: if (m_allowUpDownKeyChainEdit || event->key() == Qt::Key_Backtab) { @@ -97,6 +98,7 @@ void KItemListRoleEditor::keyPressEvent(QKeyEvent* event) event->accept(); return; } + break; case Qt::Key_Left: case Qt::Key_Right: { QTextCursor cursor = textCursor();