Skip to content
Permalink
Browse files
Merge pull request #4274 from nyalldawson/scroll_timer
A different approach to avoiding accidently scroll changes
  • Loading branch information
nyalldawson committed Mar 21, 2017
2 parents fb3d07f + ecb233b commit aad182fdc041bd5e83be5b2b399cae496826c008
Showing with 1,022 additions and 318 deletions.
  1. +7 −1 python/console/console_settings.ui
  2. +1 −0 python/gui/gui.sip
  3. +15 −0 python/gui/qgsscrollarea.sip
  4. +4 −3 python/plugins/processing/modeler/ModelerParametersDialog.py
  5. +8 −3 python/plugins/processing/ui/DlgModeler.ui
  6. +7 −1 python/plugins/processing/ui/widgetParametersPanel.ui
  7. +0 −1 src/app/composer/qgsattributeselectiondialog.cpp
  8. +2 −0 src/customwidgets/CMakeLists.txt
  9. +95 −0 src/customwidgets/qgsscrollareawidgetplugin.cpp
  10. +50 −0 src/customwidgets/qgsscrollareawidgetplugin.h
  11. +2 −0 src/gui/CMakeLists.txt
  12. +2 −1 src/gui/attributetable/qgsdualview.cpp
  13. +2 −2 src/gui/attributetable/qgsdualview.h
  14. +3 −3 src/gui/qgsattributeform.cpp
  15. +0 −1 src/gui/qgsattributetypeloaddialog.cpp
  16. +127 −0 src/gui/qgsscrollarea.cpp
  17. +100 −0 src/gui/qgsscrollarea.h
  18. +2 −1 src/plugins/evis/eventbrowser/evisimagedisplaywidget.cpp
  19. +3 −3 src/plugins/evis/eventbrowser/evisimagedisplaywidget.h
  20. +2 −1 src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp
  21. +9 −1 src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.ui
  22. +7 −1 src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.ui
  23. +2 −3 src/plugins/grass/qgsgrassmoduleoptions.cpp
  24. +9 −3 src/providers/grass/qgsgrassoptionsbase.ui
  25. +10 −4 src/ui/composer/qgsatlascompositionwidgetbase.ui
  26. +13 −7 src/ui/composer/qgscomposerarrowwidgetbase.ui
  27. +10 −4 src/ui/composer/qgscomposerattributetablewidgetbase.ui
  28. +19 −2 src/ui/composer/qgscomposerbase.ui
  29. +14 −8 src/ui/composer/qgscomposerhtmlwidgetbase.ui
  30. +10 −4 src/ui/composer/qgscomposerlabelwidgetbase.ui
  31. +16 −10 src/ui/composer/qgscomposerlegendwidgetbase.ui
  32. +14 −8 src/ui/composer/qgscomposermapgridwidgetbase.ui
  33. +13 −7 src/ui/composer/qgscomposermapwidgetbase.ui
  34. +16 −10 src/ui/composer/qgscomposerpicturewidgetbase.ui
  35. +18 −3 src/ui/composer/qgscomposerpolygonwidgetbase.ui
  36. +8 −2 src/ui/composer/qgscomposerpolylinewidgetbase.ui
  37. +18 −12 src/ui/composer/qgscomposerscalebarwidgetbase.ui
  38. +8 −2 src/ui/composer/qgscomposershapewidgetbase.ui
  39. +10 −4 src/ui/composer/qgscomposertablewidgetbase.ui
  40. +13 −7 src/ui/composer/qgscompositionwidgetbase.ui
  41. +9 −1 src/ui/editorwidgets/qgsdatetimeeditconfig.ui
  42. +11 −5 src/ui/editorwidgets/qgsexternalresourceconfigdlg.ui
  43. +9 −1 src/ui/qgscharacterselectdialogbase.ui
  44. +7 −1 src/ui/qgscustomprojectiondialogbase.ui
  45. +33 −27 src/ui/qgsdiagrampropertiesbase.ui
  46. +20 −3 src/ui/qgsgpsinformationwidgetbase.ui
  47. +10 −4 src/ui/qgsgradientcolorrampdialogbase.ui
  48. +10 −2 src/ui/qgslabelingrulepropswidget.ui
  49. +10 −4 src/ui/qgslabelpropertydialogbase.ui
  50. +13 −5 src/ui/qgsnewgeopackagelayerdialogbase.ui
  51. +14 −4 src/ui/qgsnewspatialitelayerdialogbase.ui
  52. +46 −40 src/ui/qgsoptionsbase.ui
  53. +10 −4 src/ui/qgspluginmanagerbase.ui
  54. +16 −10 src/ui/qgsprojectpropertiesbase.ui
  55. +17 −11 src/ui/qgsrasterlayerpropertiesbase.ui
  56. +13 −7 src/ui/qgsrasterlayersaveasdialogbase.ui
  57. +32 −26 src/ui/qgstextformatwidgetbase.ui
  58. +26 −20 src/ui/qgsvectorlayerpropertiesbase.ui
  59. +13 −7 src/ui/qgsvectorlayersaveasdialogbase.ui
  60. +10 −3 src/ui/styledock/qgsrenderercontainerbase.ui
  61. +15 −9 src/ui/symbollayer/widget_fontmarker.ui
  62. +9 −1 src/ui/templates/qgsoptionsdialog_template.ui
@@ -46,7 +46,7 @@
</widget>
</item>
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
<widget class="QgsScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
@@ -1139,6 +1139,12 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsScrollArea</class>
<extends>QScrollArea</extends>
<header location="global">qgis.gui</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsCollapsibleGroupBox</class>
<extends>QGroupBox</extends>
@@ -155,6 +155,7 @@
%Include qgsscalerangewidget.sip
%Include qgsscalevisibilitydialog.sip
%Include qgsscalewidget.sip
%Include qgsscrollarea.sip
%Include qgssearchquerybuilder.sip
%Include qgsshortcutsmanager.sip
%Include qgsslider.sip
@@ -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 );

};
@@ -30,13 +30,14 @@
from qgis.PyQt.QtCore import Qt, QUrl, QMetaObject
from qgis.PyQt.QtWidgets import (QDialog, QDialogButtonBox, QLabel, QLineEdit,
QFrame, QPushButton, QSizePolicy, QVBoxLayout,
QHBoxLayout, QTabWidget, QWidget, QScrollArea,
QHBoxLayout, QTabWidget, QWidget,
QTextBrowser)
from qgis.PyQt.QtNetwork import QNetworkRequest, QNetworkReply

from qgis.core import QgsNetworkAccessManager

from qgis.gui import QgsMessageBar
from qgis.gui import (QgsMessageBar,
QgsScrollArea)

from processing.gui.wrappers import InvalidParameterValue
from processing.gui.MultipleInputPanel import MultipleInputPanel
@@ -187,7 +188,7 @@ def setupUi(self):
self.tabWidget.setMinimumWidth(300)
self.paramPanel = QWidget()
self.paramPanel.setLayout(self.verticalLayout)
self.scrollArea = QScrollArea()
self.scrollArea = QgsScrollArea()
self.scrollArea.setWidget(self.paramPanel)
self.scrollArea.setWidgetResizable(True)
self.tabWidget.addTab(self.scrollArea, self.tr('Parameters'))
@@ -44,7 +44,7 @@
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_1">
<widget class="QgsScrollArea" name="scrollArea_1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
@@ -138,7 +138,7 @@
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_2">
<widget class="QgsScrollArea" name="scrollArea_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
@@ -222,7 +222,7 @@
<number>2</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_3">
<widget class="QgsScrollArea" name="scrollArea_3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
@@ -505,6 +505,11 @@
</action>
</widget>
<customwidgets>
<customwidget>
<class>QgsScrollArea</class>
<extends>QScrollArea</extends>
<header>qgis.gui</header>
</customwidget>
<customwidget>
<class>QgsFilterLineEdit</class>
<extends>QLineEdit</extends>
@@ -21,7 +21,7 @@
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<widget class="QgsScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
@@ -88,6 +88,12 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsScrollArea</class>
<extends>QScrollArea</extends>
<header>qgis.gui</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsCollapsibleGroupBox</class>
<extends>QGroupBox</extends>
@@ -29,7 +29,6 @@
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QScrollArea>
#include <QSpinBox>
#include <QSortFilterProxyModel>

@@ -32,6 +32,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
qgsrelationreferencewidgetplugin.cpp
qgsscalerangewidgetplugin.cpp
qgsscalewidgetplugin.cpp
qgsscrollareawidgetplugin.cpp
qgsspinboxplugin.cpp
)

@@ -57,6 +58,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
qgsrelationreferencewidgetplugin.h
qgsscalerangewidgetplugin.h
qgsscalewidgetplugin.h
qgsscrollareawidgetplugin.h
qgsspinboxplugin.h
)

@@ -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() );
}
@@ -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
2 src/gui/CMakeLists.txt 100644 → 100755
@@ -296,6 +296,7 @@ SET(QGIS_GUI_SRCS
qgsscalerangewidget.cpp
qgsscalevisibilitydialog.cpp
qgsscalewidget.cpp
qgsscrollarea.cpp
qgssearchquerybuilder.cpp
qgsshortcutsmanager.cpp
qgsslider.cpp
@@ -443,6 +444,7 @@ SET(QGIS_GUI_MOC_HDRS
qgsscalerangewidget.h
qgsscalevisibilitydialog.h
qgsscalewidget.h
qgsscrollarea.h
qgssearchquerybuilder.h
qgsshortcutsmanager.h
qgsslider.h
@@ -28,6 +28,7 @@
#include "qgsorganizetablecolumnsdialog.h"
#include "qgseditorwidgetregistry.h"
#include "qgssettings.h"
#include "qgsscrollarea.h"

#include <QClipboard>
#include <QDialog>
@@ -95,7 +96,7 @@ void QgsDualView::init( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const Qg
mAttributeForm = new QgsAttributeForm( mLayer, QgsFeature(), mEditorContext );
if ( !context.parentContext() )
{
mAttributeEditorScrollArea = new QScrollArea();
mAttributeEditorScrollArea = new QgsScrollArea();
mAttributeEditorScrollArea->setWidgetResizable( true );
mAttributeEditor->layout()->addWidget( mAttributeEditorScrollArea );
mAttributeEditorScrollArea->setWidget( mAttributeForm );
@@ -29,7 +29,7 @@
class QgsFeatureRequest;
class QSignalMapper;
class QgsMapLayerAction;
class QScrollArea;
class QgsScrollArea;

/** \ingroup gui
* This widget is used to show the attributes of a set of features of a {@link QgsVectorLayer}.
@@ -351,7 +351,7 @@ class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBas
QgsDistanceArea mDistanceArea;
QString mDisplayExpression;
QgsAttributeTableConfig mConfig;
QScrollArea *mAttributeEditorScrollArea = nullptr;
QgsScrollArea *mAttributeEditorScrollArea = nullptr;
QgsMapCanvas *mMapCanvas = nullptr;

friend class TestQgsDualView;
@@ -31,6 +31,7 @@
#include "qgslogger.h"
#include "qgstabwidget.h"
#include "qgssettings.h"
#include "qgsscrollarea.h"

#include <QDir>
#include <QTextStream>
@@ -42,7 +43,6 @@
#include <QKeyEvent>
#include <QLabel>
#include <QPushButton>
#include <QScrollArea>
#include <QUiLoader>
#include <QMessageBox>
#include <QToolButton>
@@ -1210,7 +1210,7 @@ void QgsAttributeForm::init()
if ( mContext.formMode() != QgsAttributeEditorContext::Embed )
{
// put the form into a scroll area to nicely handle cases with lots of attributes
QScrollArea *scrollArea = new QScrollArea( this );
QgsScrollArea *scrollArea = new QgsScrollArea( this );
scrollArea->setWidget( formWidget );
scrollArea->setWidgetResizable( true );
scrollArea->setFrameShape( QFrame::NoFrame );
@@ -1599,7 +1599,7 @@ QgsAttributeForm::WidgetInfo QgsAttributeForm::createWidgetFromDef( const QgsAtt

if ( context.formMode() != QgsAttributeEditorContext::Embed )
{
QScrollArea *scrollArea = new QScrollArea( parent );
QgsScrollArea *scrollArea = new QgsScrollArea( parent );

scrollArea->setWidget( myContainer );
scrollArea->setWidgetResizable( true );
@@ -29,7 +29,6 @@
#include <QComboBox>
#include <QLabel>
#include <QFrame>
#include <QScrollArea>
#include <QCompleter>
#include <QSpinBox>
#include <QPushButton>

0 comments on commit aad182f

Please sign in to comment.