QGIS API Documentation  3.2.0-Bonn (bc43194)
qgsscrollarea.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsscrollarea.h
3  ---------------
4  begin : March 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSSCROLLAREA_H
17 #define QGSSCROLLAREA_H
18 
19 #include <QScrollArea>
20 #include "qgis.h"
21 #include "qgis_gui.h"
22 #include <QTimer>
23 class ScrollAreaFilter;
24 
41 class GUI_EXPORT QgsScrollArea : public QScrollArea
42 {
43  Q_OBJECT
44 
45  public:
46 
50  explicit QgsScrollArea( QWidget *parent SIP_TRANSFERTHIS = nullptr );
51 
56  void scrollOccurred();
57 
62  bool hasScrolled() const;
63 
64  protected:
65  void wheelEvent( QWheelEvent *event ) override;
66 
67  private:
68  QTimer mTimer;
69  ScrollAreaFilter *mFilter = nullptr;
70 };
71 
72 #ifndef SIP_RUN
73 
75 
81 class ScrollAreaFilter : public QObject
82 {
83  Q_OBJECT
84  public:
85 
86  ScrollAreaFilter( QgsScrollArea *parent = nullptr,
87  QWidget *viewPort = nullptr );
88 
89  protected:
90  bool eventFilter( QObject *obj, QEvent *event ) override;
91 
92  private:
93  QgsScrollArea *mScrollAreaWidget = nullptr;
94  QWidget *mViewPort = nullptr;
95 
96  void addChild( QObject *child );
97  void removeChild( QObject *child );
98 
99 };
100 
102 
103 #endif
104 
105 #endif // QGSSCROLLAREA_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
A QScrollArea subclass with improved scrolling behavior.
Definition: qgsscrollarea.h:41