diff options
| author | Peter Penz <[email protected]> | 2008-10-26 14:04:17 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-10-26 14:04:17 +0000 |
| commit | 82908b442ba437cdff200e319f6db20f7a6cd65a (patch) | |
| tree | 98dadf56ce925e1b2748faec1ec28feb3bcf392f /src/dolphindetailsview.h | |
| parent | 22d22a9cd701b726366f6c6feaf31842cbb50ca4 (diff) | |
Improve the selection performance of the details view by factor of 5 (patch provided by Simon St. James).
CCMAIL: [email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=876099
Diffstat (limited to 'src/dolphindetailsview.h')
| -rw-r--r-- | src/dolphindetailsview.h | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/src/dolphindetailsview.h b/src/dolphindetailsview.h index 512bd6201..7b08e25a1 100644 --- a/src/dolphindetailsview.h +++ b/src/dolphindetailsview.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * [email protected] * + * Copyright (C) 2006 by Peter Penz ([email protected]) * + * Copyright (C) 2008 by Simon St. James ([email protected]) * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -96,7 +96,7 @@ private slots: void slotEntered(const QModelIndex& index); /** - * Updates the destination \a m_elasticBandDestination from + * Updates the destination \a destination from * the elastic band to the current mouse position and triggers * an update. */ @@ -104,8 +104,8 @@ private slots: /** * Returns the rectangle for the elastic band dependent from the - * origin \a m_elasticBandOrigin, the current destination - * \a m_elasticBandDestination and the viewport position. + * origin \a origin, the current destination + * \a destination and the viewport position. */ QRect elasticBandRect() const; @@ -143,6 +143,13 @@ private slots: void updateFont(); + /** + * If the elastic band is currently shown, update the elastic band based on + * the current mouse position and ensure that the selection is the set of items + * intersecting it. + */ + void updateElasticBandSelection(); + private: /** * Updates the size of the decoration dependent on the @@ -164,12 +171,8 @@ private: QRect nameColumnRect(const QModelIndex& index) const; - void setSelectionRecursive(const QModelIndex& startIndex, - const QRect& rect, - QItemSelectionModel::SelectionFlags command); - private: - bool m_autoResize : 1; // if true, the columns are resized automatically to the available width + bool m_autoResize : 1; // if true, the columns are resized automatically to the available width bool m_expandingTogglePressed : 1; bool m_keyPressed : 1; // true if a key is pressed currently; info used by currentChanged() bool m_useDefaultIndexAt : 1; // true, if QTreeView::indexAt() should be used @@ -182,12 +185,32 @@ private: QRect m_dropRect; - // Elastic band coordinates are relative to the origin of the - // view, not the viewport. - bool m_showElasticBand; - QPoint m_elasticBandOrigin; - QPoint m_elasticBandDestination; + struct ElasticBand + { + ElasticBand(); + + // Elastic band coordinates are relative to the origin of the + // view, not the viewport. + bool show; + QPoint origin; + QPoint destination; + // Optimisation mechanisms for use with elastic band selection. + // Basically, allow "incremental" updates to the selection based + // on the last elastic band shape. + QRect oldSelectionRect; + + // If true, compute the set of selected elements from scratch (slower) + bool ignoreOldInfo; + + // Edges of the filenames that are closest to the edges of oldSelectionRect. + // Used to decide whether horizontal changes in the elastic band are likely + // to require us to re-check which items are selected. + int outsideNearestLeftEdge; + int outsideNearestRightEdge; + int insideNearestLeftEdge; + int insideNearestRightEdge; + } m_band; }; #endif |
