diff options
| author | Peter Penz <[email protected]> | 2008-12-06 20:06:04 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-12-06 20:06:04 +0000 |
| commit | 53bdec9b58131014dcec9d6bc7d48e1aa01be979 (patch) | |
| tree | 2d8b1b193c5828c6937586f780a3d28dbec417b7 /src/dolphinviewautoscroller.h | |
| parent | d2e8f27200727a7a8d12932176f21c1e81dcad93 (diff) | |
Fixed serious usability issue: QAbstractItemView::setAutoScroll() is not usable when trying to select items outside the visible view area (reported to Qt Software with bug ID #214542) -> implemented custom auto scrolling algorithm.
BUG: 165531
svn path=/trunk/KDE/kdebase/apps/; revision=893546
Diffstat (limited to 'src/dolphinviewautoscroller.h')
| -rw-r--r-- | src/dolphinviewautoscroller.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/dolphinviewautoscroller.h b/src/dolphinviewautoscroller.h new file mode 100644 index 000000000..c02112b7b --- /dev/null +++ b/src/dolphinviewautoscroller.h @@ -0,0 +1,59 @@ +/*************************************************************************** + * Copyright (C) 2008 by Peter Penz <[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 * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef DOLPHINVIEWAUTOSCROLLER_H +#define DOLPHINVIEWAUTOSCROLLER_H + +#include <QObject> + +class QAbstractItemView; +class QTimer; + +/** + * @brief Assures that an autoscrolling is done for item views. + * + * This is a workaround as QAbstractItemView::setAutoScroll() is not usable + * when selecting items (see Qt issue #214542). + */ +class DolphinViewAutoScroller : public QObject +{ + Q_OBJECT + +public: + DolphinViewAutoScroller(QAbstractItemView* parent); + virtual ~DolphinViewAutoScroller(); + +protected: + virtual bool eventFilter(QObject* watched, QEvent* event); + +private slots: + void scrollViewport(); + +private: + void triggerAutoScroll(); + void stopAutoScroll(); + +private: + bool m_rubberBandSelection; + int m_scrollInc; + QAbstractItemView* m_itemView; + QTimer* m_timer; +}; + +#endif |
