Skip to content
Permalink
Browse files

[Geometry checker] Introduce vertical-only scroll-areas

  • Loading branch information
manisandro committed Jun 28, 2017
1 parent aa27b66 commit e0caef9271f112abb84812a35033178ea894d876
@@ -107,6 +107,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR}/src/gui

${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
INCLUDE_DIRECTORIES(SYSTEM
${GEOS_INCLUDE_DIR}
@@ -546,9 +546,9 @@ void QgsGeometryCheckerResultTab::setDefaultResolutionMethods()

QVBoxLayout *layout = new QVBoxLayout( &dialog );

QgsScrollArea *scrollArea = new QgsScrollArea( &dialog );
scrollArea->setFrameShape( QFrame::NoFrame );
layout->setContentsMargins( 0, 0, 0, 0 );
QgsGeometryCheckerUtils::VScrollArea *scrollArea = new QgsGeometryCheckerUtils::VScrollArea( &dialog );
layout->addWidget( scrollArea );

QWidget *scrollAreaContents = new QWidget( scrollArea );
@@ -27,7 +27,7 @@
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QgsScrollArea" name="scrollArea">
<widget class="QgsGeometryCheckerUtils::VScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
@@ -800,9 +800,9 @@
</widget>
<customwidgets>
<customwidget>
<class>QgsScrollArea</class>
<class>QgsGeometryCheckerUtils::VScrollArea</class>
<extends>QScrollArea</extends>
<header>qgsscrollarea.h</header>
<header>utils/qgsgeometrycheckerutils.h</header>
<container>1</container>
</customwidget>
</customwidgets>
@@ -21,12 +21,34 @@
#include "qgsvectorlayer.h"
#include "geometry/qgsabstractgeometry.h"
#include "geometry/qgspoint.h"
#include <qmath.h>
#include <QScrollArea>
#include <QScrollBar>

class QgsGeometryEngine;
class QgsFeaturePool;

namespace QgsGeometryCheckerUtils
{
class VScrollArea : public QScrollArea
{
public:
explicit VScrollArea( QWidget *parent = 0 )
: QScrollArea( parent )
{
setWidgetResizable( true );
setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );
}
virtual bool eventFilter( QObject *o, QEvent *e )
{
// This works because QScrollArea::setWidget installs an eventFilter on the widget
if ( o && o == widget() && e->type() == QEvent::Resize )
setMinimumWidth( widget()->minimumSizeHint().width() + verticalScrollBar()->width() );
return QScrollArea::eventFilter( o, e );
}
};

class LayerFeature
{
public:

0 comments on commit e0caef9

Please sign in to comment.
You can’t perform that action at this time.