Skip to content
Permalink
Browse files

Show dock on error

  • Loading branch information
m-kuhn committed Oct 3, 2018
1 parent 00fa3db commit d17011e8e27d07d0c7988954af9fb5d8ea1be1ff
Showing with 19 additions and 5 deletions.
  1. +2 −2 src/app/qgisapp.cpp
  2. +13 −2 src/app/qgsgeometryvalidationdock.cpp
  3. +4 −1 src/app/qgsgeometryvalidationdock.h
@@ -931,15 +931,14 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
{
mInfoBar->pushWarning( tr( "Geometry Validation" ), message );
} );
mGeometryValidationDock = new QgsGeometryValidationDock( tr( "Geometry Validation" ), mMapCanvas );
mGeometryValidationDock = new QgsGeometryValidationDock( tr( "Geometry Validation" ), mMapCanvas, this );
mGeometryValidationModel = new QgsGeometryValidationModel( mGeometryValidationService.get(), mGeometryValidationDock );
connect( this, &QgisApp::activeLayerChanged, mGeometryValidationModel, [this]( QgsMapLayer * layer )
{
mGeometryValidationModel->setCurrentLayer( qobject_cast<QgsVectorLayer *>( layer ) );
} );
mGeometryValidationDock->setGeometryValidationModel( mGeometryValidationModel );
mGeometryValidationDock->setGeometryValidationService( mGeometryValidationService.get() );
addDockWidget( Qt::RightDockWidgetArea, mGeometryValidationDock );
endProfile();

QgsApplication::annotationRegistry()->addAnnotationType( QgsAnnotationMetadata( QStringLiteral( "FormAnnotationItem" ), &QgsFormAnnotation::create ) );
@@ -1442,6 +1441,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
{
mCentralContainer->setCurrentIndex( 0 );
} );
mGeometryValidationDock->close();
} // QgisApp ctor

QgisApp::QgisApp()
@@ -28,11 +28,13 @@ email : matthias@opengis.ch
#include "qgsgeometrycheckregistry.h"
#include "qgsgeometryoptions.h"
#include "qgsgeometrycheckfactory.h"
#include "qgisapp.h"


QgsGeometryValidationDock::QgsGeometryValidationDock( const QString &title, QgsMapCanvas *mapCanvas, QWidget *parent, Qt::WindowFlags flags )
QgsGeometryValidationDock::QgsGeometryValidationDock( const QString &title, QgsMapCanvas *mapCanvas, QgisApp *parent, Qt::WindowFlags flags )
: QgsDockWidget( title, parent, flags )
, mMapCanvas( mapCanvas )
, mApp( parent )
{
setupUi( this );

@@ -84,7 +86,7 @@ void QgsGeometryValidationDock::setGeometryValidationModel( QgsGeometryValidatio

connect( mErrorListView->selectionModel(), &QItemSelectionModel::currentChanged, this, &QgsGeometryValidationDock::onCurrentErrorChanged );
connect( mGeometryValidationModel, &QgsGeometryValidationModel::rowsRemoved, this, &QgsGeometryValidationDock::updateCurrentError );
connect( mGeometryValidationModel, &QgsGeometryValidationModel::rowsInserted, this, &QgsGeometryValidationDock::raise );
connect( mGeometryValidationModel, &QgsGeometryValidationModel::rowsInserted, this, &QgsGeometryValidationDock::onRowsInserted );
}

void QgsGeometryValidationDock::gotoNextError()
@@ -139,6 +141,15 @@ void QgsGeometryValidationDock::updateLayerTransform()
mLayerTransform = QgsCoordinateTransform( mMapCanvas->currentLayer()->crs(), mMapCanvas->mapSettings().destinationCrs(), mMapCanvas->mapSettings().transformContext() );
}

void QgsGeometryValidationDock::onRowsInserted()
{
if ( !isVisible() )
{
mApp->addDockWidget( Qt::RightDockWidgetArea, this );
}
raise();
}

QgsGeometryValidationService *QgsGeometryValidationDock::geometryValidationService() const
{
return mGeometryValidationService;
@@ -24,6 +24,7 @@ class QgsMapCanvas;
class QgsGeometryValidationModel;
class QgsGeometryValidationService;
class QgsRubberBand;
class QgisApp;

/**
* @brief The QgsGeometryValidationDock class
@@ -33,7 +34,7 @@ class QgsGeometryValidationDock : public QgsDockWidget, public Ui_QgsGeometryVal
Q_OBJECT

public:
QgsGeometryValidationDock( const QString &title, QgsMapCanvas *mapCanvas, QWidget *parent = nullptr, Qt::WindowFlags flags = nullptr );
QgsGeometryValidationDock( const QString &title, QgsMapCanvas *mapCanvas, QgisApp *parent = nullptr, Qt::WindowFlags flags = nullptr );

QgsGeometryValidationModel *geometryValidationModel() const;
void setGeometryValidationModel( QgsGeometryValidationModel *geometryValidationModel );
@@ -51,6 +52,7 @@ class QgsGeometryValidationDock : public QgsDockWidget, public Ui_QgsGeometryVal
void zoomToFeature();
void triggerTopologyChecks();
void updateLayerTransform();
void onRowsInserted();

private:

@@ -67,6 +69,7 @@ class QgsGeometryValidationDock : public QgsDockWidget, public Ui_QgsGeometryVal
QgsGeometryValidationService *mGeometryValidationService = nullptr;
QButtonGroup *mZoomToButtonGroup = nullptr;
QgsMapCanvas *mMapCanvas = nullptr;
QgisApp *mApp = nullptr;
QgsCoordinateTransform mLayerTransform;
QModelIndex currentIndex() const;
QgsRubberBand *mFeatureRubberband = nullptr;

0 comments on commit d17011e

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