Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4274 from nyalldawson/scroll_timer
A different approach to avoiding accidently scroll changes
- Loading branch information
Showing
62 changed files
with
1,022 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class QgsScrollArea : QScrollArea | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsscrollarea.h> | ||
%End | ||
|
||
public: | ||
explicit QgsScrollArea( QWidget *parent /TransferThis/ = 0 ); | ||
void scrollOccurred(); | ||
bool hasScrolled() const; | ||
|
||
protected: | ||
void wheelEvent( QWheelEvent *event ); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/*************************************************************************** | ||
qgsscrollareawidgetplugin.cpp | ||
-------------------------------------- | ||
Date : March 2017 | ||
Copyright : (C) 2017 Nyall Dawson | ||
Email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* 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. * | ||
* * | ||
***************************************************************************/ | ||
|
||
|
||
#include "qgiscustomwidgets.h" | ||
#include "qgsscrollareawidgetplugin.h" | ||
#include "qgsscrollarea.h" | ||
|
||
|
||
QgsScrollAreaWidgetPlugin::QgsScrollAreaWidgetPlugin( QObject *parent ) | ||
: QObject( parent ) | ||
{} | ||
|
||
QString QgsScrollAreaWidgetPlugin::name() const | ||
{ | ||
return "QgsScrollArea"; | ||
} | ||
|
||
QString QgsScrollAreaWidgetPlugin::group() const | ||
{ | ||
return QgisCustomWidgets::groupName(); | ||
} | ||
|
||
QString QgsScrollAreaWidgetPlugin::includeFile() const | ||
{ | ||
return "qgsscrollarea.h"; | ||
} | ||
|
||
QIcon QgsScrollAreaWidgetPlugin::icon() const | ||
{ | ||
return QIcon( ":/images/icons/qgis-icon-60x60.png" ); | ||
} | ||
|
||
bool QgsScrollAreaWidgetPlugin::isContainer() const | ||
{ | ||
return true; | ||
} | ||
|
||
QWidget *QgsScrollAreaWidgetPlugin::createWidget( QWidget *parent ) | ||
{ | ||
return new QgsScrollArea( parent ); | ||
} | ||
|
||
bool QgsScrollAreaWidgetPlugin::isInitialized() const | ||
{ | ||
return mInitialized; | ||
} | ||
|
||
void QgsScrollAreaWidgetPlugin::initialize( QDesignerFormEditorInterface *core ) | ||
{ | ||
Q_UNUSED( core ); | ||
if ( mInitialized ) | ||
return; | ||
mInitialized = true; | ||
} | ||
|
||
|
||
QString QgsScrollAreaWidgetPlugin::toolTip() const | ||
{ | ||
return tr( "Scroll area" ); | ||
} | ||
|
||
QString QgsScrollAreaWidgetPlugin::whatsThis() const | ||
{ | ||
return ""; | ||
} | ||
|
||
QString QgsScrollAreaWidgetPlugin::domXml() const | ||
{ | ||
return QString( "<ui language=\"c++\">\n" | ||
" <widget class=\"%1\" name=\"mScrollArea\">\n" | ||
" <property name=\"geometry\">\n" | ||
" <rect>\n" | ||
" <x>0</x>\n" | ||
" <y>0</y>\n" | ||
" <width>300</width>\n" | ||
" <height>100</height>\n" | ||
" </rect>\n" | ||
" </property>\n" | ||
" </widget>\n" | ||
"</ui>\n" ) | ||
.arg( name() ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/*************************************************************************** | ||
qgsscrollareawidgetplugin.h | ||
-------------------------------------- | ||
Date : March 2017 | ||
Copyright : (C) 2017 Nyall Dawson | ||
Email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* 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. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSSCROLLAREAWIDGETPLUGIN_H | ||
#define QGSSCROLLAREAWIDGETPLUGIN_H | ||
|
||
|
||
#include <QtGlobal> | ||
#include <QtUiPlugin/QDesignerCustomWidgetInterface> | ||
#include <QtUiPlugin/QDesignerExportWidget> | ||
#include "qgis_customwidgets.h" | ||
|
||
class CUSTOMWIDGETS_EXPORT QgsScrollAreaWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface | ||
{ | ||
Q_OBJECT | ||
Q_INTERFACES( QDesignerCustomWidgetInterface ) | ||
|
||
public: | ||
explicit QgsScrollAreaWidgetPlugin( QObject *parent = 0 ); | ||
|
||
private: | ||
bool mInitialized = false; | ||
|
||
// QDesignerCustomWidgetInterface interface | ||
public: | ||
QString name() const override; | ||
QString group() const override; | ||
QString includeFile() const override; | ||
QIcon icon() const override; | ||
bool isContainer() const override; | ||
QWidget *createWidget( QWidget *parent ) override; | ||
bool isInitialized() const override; | ||
void initialize( QDesignerFormEditorInterface *core ) override; | ||
QString toolTip() const override; | ||
QString whatsThis() const override; | ||
QString domXml() const override; | ||
}; | ||
#endif // QGSSCROLLAREAWIDGETPLUGIN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.