From beeb81194cba3ecaa84c6e0e334a702036a26c1e Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 24 Feb 2009 08:25:01 +0000 Subject: [PATCH] Stupid me: The inconsistent behavior between QListView::scrollTo() and QTreeView::scrollTo() has been fixed in Qt 4.5 :-) I should have tested this _before_ committing the huge patch for bug 185191... So: * Remove the workaround in DolphinIconsView::scrollTo() to bypass an issue in Qt 4.4 (-> fixed in Qt 4.5) * Revert the "use the DolphinController"-parts of commit 930754 and just use QAbstractItemView::scrollTo() instead. CCBUG: 185191 svn path=/trunk/KDE/kdebase/apps/; revision=930777 --- src/dolphincolumnview.cpp | 8 -------- src/dolphincolumnview.h | 1 - src/dolphincontroller.cpp | 5 ----- src/dolphincontroller.h | 13 ------------- src/dolphindetailsview.cpp | 7 ------- src/dolphindetailsview.h | 2 -- src/dolphiniconsview.cpp | 24 ------------------------ src/dolphiniconsview.h | 3 --- src/dolphinview.cpp | 5 +---- 9 files changed, 1 insertion(+), 67 deletions(-) diff --git a/src/dolphincolumnview.cpp b/src/dolphincolumnview.cpp index 16d72c0f0..4d180442b 100644 --- a/src/dolphincolumnview.cpp +++ b/src/dolphincolumnview.cpp @@ -59,8 +59,6 @@ DolphinColumnView::DolphinColumnView(QWidget* parent, DolphinController* control this, SLOT(setZoomLevel(int))); connect(controller, SIGNAL(activationChanged(bool)), this, SLOT(updateColumnsBackground(bool))); - connect(controller, SIGNAL(scrollToCurrentItem()), - this, SLOT(scrollToCurrentItem())); const DolphinView* view = controller->dolphinView(); connect(view, SIGNAL(sortingChanged(DolphinView::Sorting)), @@ -467,12 +465,6 @@ void DolphinColumnView::slotShowPreviewChanged() } } -void DolphinColumnView::scrollToCurrentItem() -{ - const QModelIndex activeIndex = activeColumn()->currentIndex(); - activeColumn()->scrollTo(activeIndex); -} - void DolphinColumnView::setActiveColumnIndex(int index) { if (m_index == index) { diff --git a/src/dolphincolumnview.h b/src/dolphincolumnview.h index 756037874..65e4ff3e9 100644 --- a/src/dolphincolumnview.h +++ b/src/dolphincolumnview.h @@ -169,7 +169,6 @@ private slots: void slotSortOrderChanged(Qt::SortOrder order); void slotShowHiddenFilesChanged(); void slotShowPreviewChanged(); - void scrollToCurrentItem(); private: DolphinColumnWidget* activeColumn() const; diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp index cfa0d62c8..b128c9033 100644 --- a/src/dolphincontroller.cpp +++ b/src/dolphincontroller.cpp @@ -124,11 +124,6 @@ void DolphinController::setZoomLevel(int level) } } -void DolphinController::triggerScrollToCurrentItem() -{ - emit scrollToCurrentItem(); -} - void DolphinController::handleKeyPressEvent(QKeyEvent* event) { Q_ASSERT(m_itemView != 0); diff --git a/src/dolphincontroller.h b/src/dolphincontroller.h index ba1036060..29dd7dfb1 100644 --- a/src/dolphincontroller.h +++ b/src/dolphincontroller.h @@ -73,7 +73,6 @@ class QWidget; * - setShowPreview() * - indicateActivationChange() * - setZoomLevel() - * - triggerScrollToCurrentItem() */ class LIBDOLPHINPRIVATE_EXPORT DolphinController : public QObject { @@ -190,12 +189,6 @@ public: void setZoomLevel(int level); int zoomLevel() const; - /** - * Triggers the view implementation to assure having a fully visible - * current item. The signal scrollToCurrentItem() will be emitted. - */ - void triggerScrollToCurrentItem(); - /** * Tells the view implementation to zoom out by emitting the signal zoomOut() * and is invoked by the abstract Dolphin view. @@ -376,12 +369,6 @@ signals: */ void hideToolTip(); - /** - * Is emitted if the view implementation should scroll to the current item, so - * that it is fully visible. - */ - void scrollToCurrentItem(); - private slots: void updateMouseButtonState(); diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index fbd7e41d5..dd58e5842 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -128,8 +128,6 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr this, SLOT(updateColumnVisibility())); connect(controller, SIGNAL(activationChanged(bool)), this, SLOT(slotActivationChanged(bool))); - connect(controller, SIGNAL(scrollToCurrentItem()), - this, SLOT(scrollToCurrentItem())); if (settings->useSystemFont()) { m_font = KGlobalSettings::generalFont(); @@ -868,11 +866,6 @@ void DolphinDetailsView::setFoldersExpandable(bool expandable) setItemsExpandable(expandable); } -void DolphinDetailsView::scrollToCurrentItem() -{ - scrollTo(currentIndex()); -} - void DolphinDetailsView::updateDecorationSize(bool showPreview) { DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); diff --git a/src/dolphindetailsview.h b/src/dolphindetailsview.h index e60400b44..38aea12de 100644 --- a/src/dolphindetailsview.h +++ b/src/dolphindetailsview.h @@ -159,8 +159,6 @@ private slots: */ void setFoldersExpandable(bool expandable); - void scrollToCurrentItem(); - private: /** * Updates the size of the decoration dependent on the diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index 4b861df44..4c7e9180f 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -40,7 +40,6 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controller) : KCategorizedView(parent), - m_enableScrollTo(false), m_controller(controller), m_selectionManager(0), m_autoScroller(0), @@ -88,8 +87,6 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle controller, SLOT(emitViewportEntered())); connect(controller, SIGNAL(zoomLevelChanged(int)), this, SLOT(setZoomLevel(int))); - connect(controller, SIGNAL(scrollToCurrentItem()), - this, SLOT(scrollToCurrentItem())); const DolphinView* view = controller->dolphinView(); connect(view, SIGNAL(showPreviewChanged()), @@ -138,19 +135,6 @@ DolphinIconsView::~DolphinIconsView() m_categoryDrawer = 0; } -void DolphinIconsView::scrollTo(const QModelIndex& index, ScrollHint hint) -{ - // Enable the QListView implementation of scrollTo() only if it has been - // triggered by a key press. Otherwise QAbstractItemView wants to scroll to the current - // index each time the layout has been changed. This becomes an issue when - // previews are loaded and the scrollbar is used: the scrollbar will always - // be reset to 0 on each new preview. - if (m_enableScrollTo || (state() != QAbstractItemView::NoState)) { - KCategorizedView::scrollTo(index, hint); - m_enableScrollTo = false; - } -} - void DolphinIconsView::dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight) { KCategorizedView::dataChanged(topLeft, bottomRight); @@ -263,7 +247,6 @@ void DolphinIconsView::dropEvent(QDropEvent* event) void DolphinIconsView::keyPressEvent(QKeyEvent* event) { - m_enableScrollTo = true; // see DolphinIconsView::scrollTo() KCategorizedView::keyPressEvent(event); m_controller->handleKeyPressEvent(event); } @@ -392,13 +375,6 @@ void DolphinIconsView::slotGlobalSettingsChanged(int category) } } -void DolphinIconsView::scrollToCurrentItem() -{ - m_enableScrollTo = true; - scrollTo(currentIndex()); - m_enableScrollTo = false; -} - void DolphinIconsView::updateGridSize(bool showPreview, int additionalInfoCount) { const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); diff --git a/src/dolphiniconsview.h b/src/dolphiniconsview.h index 8a1f1f8dd..8cb2fd3af 100644 --- a/src/dolphiniconsview.h +++ b/src/dolphiniconsview.h @@ -49,7 +49,6 @@ class LIBDOLPHINPRIVATE_EXPORT DolphinIconsView : public KCategorizedView public: explicit DolphinIconsView(QWidget* parent, DolphinController* controller); virtual ~DolphinIconsView(); - virtual void scrollTo(const QModelIndex& index, ScrollHint hint = EnsureVisible); protected slots: virtual void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight); @@ -76,7 +75,6 @@ private slots: void setZoomLevel(int level); void requestActivation(); void slotGlobalSettingsChanged(int category); - void scrollToCurrentItem(); private: /** @@ -92,7 +90,6 @@ private: int additionalInfoCount() const; private: - bool m_enableScrollTo; DolphinController* m_controller; SelectionManager* m_selectionManager; DolphinViewAutoScroller* m_autoScroller; diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 638e6e7cb..52dac968b 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -1160,10 +1160,7 @@ void DolphinView::slotRefreshItems() { if (m_assureVisibleCurrentIndex) { m_assureVisibleCurrentIndex = false; - // Invoking itemView()->scrollTo(itemView()->currentIndex()) is - // not sufficient, as QListView and QTreeView have an inconsistent - // default behavior. - m_controller->triggerScrollToCurrentItem(); + itemView()->scrollTo(itemView()->currentIndex()); } } -- 2.47.3