X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/a49fe38e3eb59e8a5893bfe79f35a51c0acbb4eb..b60da9b67acbfe94e43bd631e4e685f366d53ec5:/src/dolphindetailsview.cpp diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index 5c77ff710..c81ec089c 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -25,6 +25,7 @@ #include "dolphinfileitemdelegate.h" #include "dolphinsettings.h" #include "dolphinsortfilterproxymodel.h" +#include "dolphinviewautoscroller.h" #include "draganddrophelper.h" #include "selectionmanager.h" #include "viewproperties.h" @@ -75,6 +76,7 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr setEditTriggers(QAbstractItemView::NoEditTriggers); setMouseTracking(true); + new DolphinViewAutoScroller(this); const ViewProperties props(controller->url()); setSortIndicatorSection(props.sorting()); @@ -96,10 +98,8 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr connect(parent, SIGNAL(sortOrderChanged(Qt::SortOrder)), this, SLOT(setSortIndicatorOrder(Qt::SortOrder))); - // TODO: Connecting to the signal 'activated()' is not possible, as kstyle - // does not forward the single vs. doubleclick to it yet (KDE 4.1?). Hence it is - // necessary connecting the signal 'singleClick()' or 'doubleClick' and to handle the - // RETURN-key in keyPressEvent(). + connect(this, SIGNAL(clicked(const QModelIndex&)), + controller, SLOT(requestTab(const QModelIndex&))); if (KGlobalSettings::singleClick()) { connect(this, SIGNAL(clicked(const QModelIndex&)), controller, SLOT(triggerItem(const QModelIndex&))); @@ -169,11 +169,6 @@ bool DolphinDetailsView::event(QEvent* event) hideColumn(DolphinModel::Rating); hideColumn(DolphinModel::Tags); - } else if (event->type() == QEvent::UpdateRequest) { - // a wheel movement will scroll 4 items - if (model()->rowCount() > 0) { - verticalScrollBar()->setSingleStep((sizeHintForRow(0) / 3) * 4); - } } return QTreeView::event(event); @@ -402,10 +397,10 @@ void DolphinDetailsView::keyReleaseEvent(QKeyEvent* event) void DolphinDetailsView::resizeEvent(QResizeEvent* event) { + QTreeView::resizeEvent(event); if (m_autoResize) { resizeColumns(); } - QTreeView::resizeEvent(event); } void DolphinDetailsView::wheelEvent(QWheelEvent* event) @@ -419,7 +414,10 @@ void DolphinDetailsView::wheelEvent(QWheelEvent* event) event->ignore(); return; } - + + const int height = m_decorationSize.height(); + const int step = (height >= KIconLoader::SizeHuge) ? height / 10 : (KIconLoader::SizeHuge - height) / 2; + verticalScrollBar()->setSingleStep(step); QTreeView::wheelEvent(event); } @@ -591,6 +589,7 @@ void DolphinDetailsView::configureColumns(const QPoint& pos) m_controller->indicateAdditionalInfoChange(list); setColumnHidden(columnIndex, !show); + resizeColumns(); } }