Skip to content
Permalink
Browse files

Merge pull request #33833 from kadas-albireo/vectorprops

Move QgsVectorLayerProperties and dependencies to GUI
  • Loading branch information
manisandro committed Mar 9, 2020
2 parents cb01e4e + e45bea5 commit aca8e030bf96aa3f6ec386c847524c7892b7bb8a
Showing with 981 additions and 575 deletions.
  1. +1 −0 python/CMakeLists.txt
  2. +7 −0 python/gui/auto_generated/qgsmaplayerconfigwidget.sip.in
  3. +54 −0 python/gui/auto_generated/vector/qgsvectorlayerproperties.sip.in
  4. +1 −0 python/gui/gui_auto.sip
  5. +29 −5 src/app/3d/qgsvectorlayer3drendererwidget.cpp
  6. +16 −2 src/app/3d/qgsvectorlayer3drendererwidget.h
  7. +3 −28 src/app/CMakeLists.txt
  8. +22 −1 src/app/qgisapp.cpp
  9. +2 −2 src/app/qgsappscreenshots.cpp
  10. +1 −1 src/app/qgslayerstylingwidget.cpp
  11. +182 −0 src/app/qgsvectorlayerdigitizingproperties.cpp
  12. +60 −0 src/app/qgsvectorlayerdigitizingproperties.h
  13. +59 −0 src/gui/CMakeLists.txt
  14. 0 src/{app → gui}/attributeformconfig/qgsattributeformcontaineredit.cpp
  15. +6 −2 src/{app → gui}/attributeformconfig/qgsattributeformcontaineredit.h
  16. 0 src/{app → gui}/attributeformconfig/qgsattributerelationedit.cpp
  17. +5 −2 src/{app → gui}/attributeformconfig/qgsattributerelationedit.h
  18. +0 −1 src/{app → gui}/attributeformconfig/qgsattributetypedialog.cpp
  19. +5 −2 src/{app → gui}/attributeformconfig/qgsattributetypedialog.h
  20. 0 src/{app → gui}/attributeformconfig/qgsattributewidgetedit.cpp
  21. +6 −2 src/{app → gui}/attributeformconfig/qgsattributewidgetedit.h
  22. +8 −6 src/{app → gui}/labeling/qgslabelengineconfigdialog.cpp
  23. +29 −6 src/{app → gui}/labeling/qgslabelengineconfigdialog.h
  24. +4 −4 src/{app → gui}/labeling/qgslabelingwidget.cpp
  25. +14 −3 src/{app → gui}/labeling/qgslabelingwidget.h
  26. 0 src/{app → gui}/labeling/qgsrulebasedlabelingwidget.cpp
  27. +50 −22 src/{app → gui}/labeling/qgsrulebasedlabelingwidget.h
  28. 0 src/{app → gui}/qgsaddattrdialog.cpp
  29. +16 −3 src/{app → gui}/qgsaddattrdialog.h
  30. +0 −1 src/{app → gui}/qgsaddtaborgroup.cpp
  31. +18 −2 src/{app → gui}/qgsaddtaborgroup.h
  32. +6 −0 src/gui/qgsmaplayerconfigwidget.h
  33. 0 src/{app → gui}/qgsmaplayerstylecategoriesmodel.cpp
  34. +16 −4 src/{app → gui}/qgsmaplayerstylecategoriesmodel.h
  35. +7 −2 src/{app → gui}/qgsmaskingwidget.cpp
  36. +14 −1 src/{app → gui}/qgsmaskingwidget.h
  37. 0 src/{app → gui}/qgsmasksourceselectionwidget.cpp
  38. +10 −1 src/{app → gui}/qgsmasksourceselectionwidget.h
  39. 0 src/{app → gui}/qgssymbollayerselectionwidget.cpp
  40. +6 −2 src/{app → gui}/qgssymbollayerselectionwidget.h
  41. +0 −1 src/{app → gui/vector}/qgsattributeactiondialog.cpp
  42. +5 −2 src/{app → gui/vector}/qgsattributeactiondialog.h
  43. +0 −1 src/{app → gui/vector}/qgsattributeactionpropertiesdialog.cpp
  44. +5 −1 src/{app → gui/vector}/qgsattributeactionpropertiesdialog.h
  45. 0 src/{app → gui/vector}/qgsattributesforminitcode.cpp
  46. +5 −2 src/{app → gui/vector}/qgsattributesforminitcode.h
  47. +20 −20 src/{app → gui/vector}/qgsattributesformproperties.cpp
  48. +14 −13 src/{app → gui/vector}/qgsattributesformproperties.h
  49. +18 −7 src/{app → gui/vector}/qgsdiagramproperties.cpp
  50. +5 −15 src/{app → gui/vector}/qgsdiagramproperties.h
  51. +0 −1 src/{app → gui/vector}/qgsfieldcalculator.cpp
  52. +5 −2 src/{app → gui/vector}/qgsfieldcalculator.h
  53. 0 src/{app → gui/vector}/qgsjoindialog.cpp
  54. +5 −2 src/{app → gui/vector}/qgsjoindialog.h
  55. +1 −0 src/{app → gui/vector}/qgssourcefieldsproperties.cpp
  56. +5 −3 src/{app → gui/vector}/qgssourcefieldsproperties.h
  57. 0 src/{app → gui/vector}/qgsvectorlayerlegendwidget.cpp
  58. +5 −1 src/{app → gui/vector}/qgsvectorlayerlegendwidget.h
  59. +3 −4 src/{app → gui/vector}/qgsvectorlayerloadstyledialog.cpp
  60. +5 −2 src/{app → gui/vector}/qgsvectorlayerloadstyledialog.h
  61. +33 −177 src/{app → gui/vector}/qgsvectorlayerproperties.cpp
  62. +16 −43 src/{app → gui/vector}/qgsvectorlayerproperties.h
  63. 0 src/{app → gui/vector}/qgsvectorlayersavestyledialog.cpp
  64. +5 −1 src/{app → gui/vector}/qgsvectorlayersavestyledialog.h
  65. 0 src/{app → gui/vector}/qgswmsdimensiondialog.cpp
  66. +5 −2 src/{app → gui/vector}/qgswmsdimensiondialog.h
  67. +129 −0 src/ui/qgsvectorlayerdigitizingproperties.ui
  68. +34 −170 src/ui/qgsvectorlayerpropertiesbase.ui
  69. +1 −0 tests/src/app/CMakeLists.txt
@@ -152,6 +152,7 @@ IF (WITH_GUI)
${CMAKE_SOURCE_DIR}/src/gui/processing
${CMAKE_SOURCE_DIR}/src/gui/processing/models
${CMAKE_SOURCE_DIR}/src/gui/tableeditor
${CMAKE_SOURCE_DIR}/src/gui/vector

${CMAKE_BINARY_DIR}/src/gui
)
@@ -43,6 +43,13 @@ be called for the layer after applying changes. This is true by default, but som
(for example 3D rendering config) do not need layer repaint as they do not modify 2D map rendering.

.. versionadded:: 3.8
%End

virtual void syncToLayer( QgsMapLayer *layer );
%Docstring
Reset to original (vector layer) values

.. versionadded:: 3.14
%End

public slots:
@@ -0,0 +1,54 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/vector/qgsvectorlayerproperties.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsVectorLayerProperties : QgsOptionsDialogBase
{
%Docstring
*************************************************************************

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. *

**************************************************************************
%End

%TypeHeaderCode
#include "qgsvectorlayerproperties.h"
%End
public:

QgsVectorLayerProperties( QgsMapCanvas *canvas, QgsMessageBar *messageBar, QgsVectorLayer *lyr = 0, QWidget *parent = 0, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );

void addPropertiesPageFactory( QgsMapLayerConfigWidgetFactory *factory );
%Docstring
Adds a properties page factory to the vector layer properties dialog.
%End

protected slots:

signals:



};


/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/vector/qgsvectorlayerproperties.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -332,6 +332,7 @@
%Include auto_generated/raster/qgssinglebandpseudocolorrendererwidget.sip
%Include auto_generated/raster/qgsrasterlayerproperties.sip
%Include auto_generated/raster/qgsrasterlayertemporalpropertieswidget.sip
%Include auto_generated/vector/qgsvectorlayerproperties.sip
%Include auto_generated/symbology/characterwidget.sip
%Include auto_generated/symbology/qgs25drendererwidget.sip
%Include auto_generated/symbology/qgsarrowsymbollayerwidget.sip
@@ -67,7 +67,7 @@ QgsAbstract3DSymbol *QgsSingleSymbol3DRendererWidget::symbol()

// -------

QgsVectorLayer3DRendererWidget::QgsVectorLayer3DRendererWidget( QgsVectorLayer *layer, QgsMapCanvas *canvas, QWidget *parent )
QgsVectorLayer3DRendererWidget::QgsVectorLayer3DRendererWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent )
: QgsMapLayerConfigWidget( layer, canvas, parent )
{
setPanelTitle( tr( "3D View" ) );
@@ -103,21 +103,26 @@ QgsVectorLayer3DRendererWidget::QgsVectorLayer3DRendererWidget( QgsVectorLayer *
}


void QgsVectorLayer3DRendererWidget::setLayer( QgsVectorLayer *layer )
void QgsVectorLayer3DRendererWidget::syncToLayer( QgsMapLayer *layer )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
if ( !vlayer )
{
return;
}
mLayer = layer;

int pageIndex;
QgsAbstract3DRenderer *r = layer->renderer3D();
QgsAbstract3DRenderer *r = vlayer->renderer3D();
if ( r && r->type() == QLatin1String( "vector" ) )
{
pageIndex = 1;
widgetSingleSymbolRenderer->setLayer( layer );
widgetSingleSymbolRenderer->setLayer( vlayer );
}
else if ( r && r->type() == QLatin1String( "rulebased" ) )
{
pageIndex = 2;
widgetRuleBasedRenderer->setLayer( layer );
widgetRuleBasedRenderer->setLayer( vlayer );
}
else
{
@@ -186,3 +191,22 @@ void QgsVectorLayer3DRendererWidget::onRendererTypeChanged( int index )
}
emit widgetChanged();
}


QgsVectorLayer3DRendererWidgetFactory::QgsVectorLayer3DRendererWidgetFactory( QObject *parent )
: QObject( parent )
{
setIcon( QIcon( ":/images/themes/default/3d.svg" ) );
setTitle( tr( "3D View" ) );
}

QgsMapLayerConfigWidget *QgsVectorLayer3DRendererWidgetFactory::createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget, QWidget *parent ) const
{
Q_UNUSED( dockWidget )
return new QgsVectorLayer3DRendererWidget( layer, canvas, parent );
}

bool QgsVectorLayer3DRendererWidgetFactory::supportsLayer( QgsMapLayer *layer ) const
{
return layer->type() == QgsMapLayerType::VectorLayer;
}
@@ -19,6 +19,7 @@
#include <memory>

#include "qgsmaplayerconfigwidget.h"
#include "qgsmaplayerconfigwidgetfactory.h"
#include "qgsvectorlayer3drenderer.h"

class QComboBox;
@@ -61,9 +62,9 @@ class QgsVectorLayer3DRendererWidget : public QgsMapLayerConfigWidget
{
Q_OBJECT
public:
explicit QgsVectorLayer3DRendererWidget( QgsVectorLayer *layer, QgsMapCanvas *canvas, QWidget *parent = nullptr );
explicit QgsVectorLayer3DRendererWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent = nullptr );

void setLayer( QgsVectorLayer *layer );
void syncToLayer( QgsMapLayer *layer ) override;

void setDockMode( bool dockMode ) override;

@@ -86,5 +87,18 @@ class QgsVectorLayer3DRendererWidget : public QgsMapLayerConfigWidget
QgsRuleBased3DRendererWidget *widgetRuleBasedRenderer = nullptr;
};

class QgsVectorLayer3DRendererWidgetFactory : public QObject, public QgsMapLayerConfigWidgetFactory
{
Q_OBJECT
public:
explicit QgsVectorLayer3DRendererWidgetFactory( QObject *parent = nullptr );
QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget, QWidget *parent ) const override;

bool supportLayerPropertiesDialog() const override { return true; }

bool supportsLayer( QgsMapLayer *layer ) const override;
};



#endif // QGSVECTORLAYER3DRENDERERWIDGET_H
@@ -7,11 +7,6 @@ SET(QGIS_APP_SRCS
${CMAKE_SOURCE_DIR}/external/nmea/gmath.c
${CMAKE_SOURCE_DIR}/external/nmea/time.c

attributeformconfig/qgsattributeformcontaineredit.cpp
attributeformconfig/qgsattributerelationedit.cpp
attributeformconfig/qgsattributetypedialog.cpp
attributeformconfig/qgsattributewidgetedit.cpp

qgisapp.cpp
qgisappinterface.cpp
qgisappstylesheet.cpp
@@ -22,16 +17,9 @@ SET(QGIS_APP_SRCS
qgsappcoordinateoperationhandlers.cpp
qgsapplayertreeviewmenuprovider.cpp
qgsappwindowmanager.cpp
qgsaddattrdialog.cpp
qgsaddtaborgroup.cpp
qgsappscreenshots.cpp
qgsjoindialog.cpp
qgswmsdimensiondialog.cpp
qgsannotationwidget.cpp
qgsappsslerrorhandler.cpp
qgsattributeactiondialog.cpp
qgsattributeactionpropertiesdialog.cpp
qgsattributesforminitcode.cpp
qgsattributetabledialog.cpp
qgsbookmarks.cpp
qgsbookmarkeditordialog.cpp
@@ -45,16 +33,12 @@ SET(QGIS_APP_SRCS
qgsguivectorlayertools.cpp
qgshtmlannotationdialog.cpp
qgsdelattrdialog.cpp
qgsdiagramproperties.cpp
qgsdisplayangle.cpp
qgsfieldcalculator.cpp
qgsfirstrundialog.cpp
qgsfixattributedialog.cpp
qgsgeometryvalidationservice.cpp
qgsgeometryvalidationdock.cpp
qgsgeometryvalidationmodel.cpp
qgssourcefieldsproperties.cpp
qgsattributesformproperties.cpp
qgsidentifyresultsdialog.cpp
qgsfeatureaction.cpp
qgslayercapabilitiesmodel.cpp
@@ -65,10 +49,7 @@ SET(QGIS_APP_SRCS
qgslayertreeviewnocrsindicator.cpp
qgslayertreeviewnonremovableindicator.cpp
qgslayertreeviewbadlayerindicator.cpp
qgsmaskingwidget.cpp
qgsmasksourceselectionwidget.cpp
qgsmapcanvasdockwidget.cpp
qgsmaplayerstylecategoriesmodel.cpp
qgsmapsavedialog.cpp
qgsprojectlistitemdelegate.cpp
qgspuzzlewidget.cpp
@@ -78,11 +59,10 @@ SET(QGIS_APP_SRCS
qgsstatusbarcoordinateswidget.cpp
qgsstatusbarmagnifierwidget.cpp
qgsstatusbarscalewidget.cpp
qgssymbollayerselectionwidget.cpp
qgstemplateprojectsmodel.cpp
qgsvectorlayerloadstyledialog.cpp
qgsversioninfo.cpp
qgsrecentprojectsitemsmodel.cpp
qgsvectorlayerdigitizingproperties.cpp
qgswelcomepage.cpp

qgsmaptooladdfeature.cpp
@@ -154,9 +134,6 @@ SET(QGIS_APP_SRCS
qgstextannotationdialog.cpp
qgssvgannotationdialog.cpp
qgsundowidget.cpp
qgsvectorlayerlegendwidget.cpp
qgsvectorlayersavestyledialog.cpp
qgsvectorlayerproperties.cpp
qgsmapthemes.cpp
qgshandlebadlayers.cpp
qgsmaptooladdcircularstring.cpp
@@ -185,15 +162,12 @@ SET(QGIS_APP_SRCS
browser/qgsinbuiltdataitemproviders.cpp

labeling/qgslabelpropertydialog.cpp
labeling/qgslabelengineconfigdialog.cpp
labeling/qgslabelingwidget.cpp
labeling/qgsmaptoolchangelabelproperties.cpp
labeling/qgsmaptoolpinlabels.cpp
labeling/qgsmaptoolshowhidelabels.cpp
labeling/qgsmaptoollabel.cpp
labeling/qgsmaptoolmovelabel.cpp
labeling/qgsmaptoolrotatelabel.cpp
labeling/qgsrulebasedlabelingwidget.cpp

layout/qgslayoutappmenuprovider.cpp
layout/qgslayoutdesignerdialog.cpp
@@ -395,7 +369,6 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/external

${CMAKE_SOURCE_DIR}/src/app
${CMAKE_SOURCE_DIR}/src/app/attributeformconfig
${CMAKE_SOURCE_DIR}/src/app/decorations
${CMAKE_SOURCE_DIR}/src/app/labeling
${CMAKE_SOURCE_DIR}/src/app/layout
@@ -430,6 +403,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/core/effects
${CMAKE_SOURCE_DIR}/src/core/validity
${CMAKE_SOURCE_DIR}/src/gui
${CMAKE_SOURCE_DIR}/src/gui/attributeformconfig
${CMAKE_SOURCE_DIR}/src/gui/symbology
${CMAKE_SOURCE_DIR}/src/gui/attributetable
${CMAKE_SOURCE_DIR}/src/gui/auth
@@ -443,6 +417,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/gui/editorwidgets/core
${CMAKE_SOURCE_DIR}/src/gui/layertree
${CMAKE_SOURCE_DIR}/src/gui/locator
${CMAKE_SOURCE_DIR}/src/gui/vector
${CMAKE_SOURCE_DIR}/src/plugins
${CMAKE_SOURCE_DIR}/src/python
${CMAKE_SOURCE_DIR}/src/native
@@ -110,6 +110,7 @@
#include "qgs3dmaptoolmeasureline.h"
#include "layout/qgslayout3dmapwidget.h"
#include "layout/qgslayoutviewrubberband.h"
#include "qgsvectorlayer3drendererwidget.h"
#endif

#include "qgsgui.h"
@@ -332,6 +333,7 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
#include "qgsvectorfilewriter.h"
#include "qgsvectorlayer.h"
#include "qgsvectorlayerproperties.h"
#include "qgsvectorlayerdigitizingproperties.h"
#include "qgsmapthemes.h"
#include "qgsmessagelogviewer.h"
#include "qgsdataitem.h"
@@ -1239,6 +1241,11 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
addWindow( mWindowAction );
#endif

registerMapLayerPropertiesFactory( new QgsVectorLayerDigitizingPropertiesFactory( this ) );
#ifdef HAVE_3D
registerMapLayerPropertiesFactory( new QgsVectorLayer3DRendererWidgetFactory( this ) );
#endif

activateDeactivateLayerRelatedActions( nullptr ); // after members were created

connect( QgsGui::mapLayerActionRegistry(), &QgsMapLayerActionRegistry::changed, this, &QgisApp::refreshActionFeatureAction );
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mapLayer );

QgsVectorLayerProperties *vectorLayerPropertiesDialog = new QgsVectorLayerProperties( vlayer, this );
QgsVectorLayerProperties *vectorLayerPropertiesDialog = new QgsVectorLayerProperties( mMapCanvas, visibleMessageBar(), vlayer, this );
connect(
vectorLayerPropertiesDialog, static_cast<void ( QgsVectorLayerProperties::* )( QgsMapLayer * )>( &QgsVectorLayerProperties::toggleEditing ),
this, [ = ]( QgsMapLayer * layer ) { toggleEditing( layer ); }
);
connect( vectorLayerPropertiesDialog, &QgsVectorLayerProperties::exportAuxiliaryLayer, this, [ = ]( QgsAuxiliaryLayer * layer )
{
if ( layer )
{
std::unique_ptr<QgsVectorLayer> clone;
clone.reset( layer->toSpatialLayer() );

saveAsFile( clone.get() );
}
} );
for ( QgsMapLayerConfigWidgetFactory *factory : qgis::as_const( mMapLayerPanelFactories ) )
{
vectorLayerPropertiesDialog->addPropertiesPageFactory( factory );
@@ -236,7 +236,7 @@ void QgsAppScreenShots::setGradientSize( int size )
void QgsAppScreenShots::takeVectorLayerProperties()
{
QString folder = QStringLiteral( "working_with_vector/img/auto_generated/vector_layer_properties" );
QgsVectorLayerProperties *dlg = new QgsVectorLayerProperties( mLineLayer, QgisApp::instance() );
QgsVectorLayerProperties *dlg = new QgsVectorLayerProperties( QgisApp::instance()->mapCanvas(), QgisApp::instance()->visibleMessageBar(), mLineLayer, QgisApp::instance() );
dlg->show();
dlg->mJoinTreeWidget->expandAll(); // expand join tree
// ----------------
@@ -273,7 +273,7 @@ void QgsAppScreenShots::takeVectorLayerProperties()
void QgsAppScreenShots::takeVectorLayerProperties25DSymbol()
{
QString folder = QStringLiteral( "working_with_vector/img/auto_generated/vector_layer_properties/" );
QgsVectorLayerProperties *dlg = new QgsVectorLayerProperties( mPolygonLayer, QgisApp::instance() );
QgsVectorLayerProperties *dlg = new QgsVectorLayerProperties( QgisApp::instance()->mapCanvas(), QgisApp::instance()->visibleMessageBar(), mPolygonLayer, QgisApp::instance() );
dlg->show();
dlg->mOptionsListWidget->setCurrentRow( 2 );
Q_ASSERT( dlg->mOptionsListWidget->currentItem()->icon().pixmap( 24, 24 ).toImage()
@@ -476,7 +476,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
mVector3DWidget->setDockMode( true );
connect( mVector3DWidget, &QgsVectorLayer3DRendererWidget::widgetChanged, this, &QgsLayerStylingWidget::autoApply );
}
mVector3DWidget->setLayer( vlayer );
mVector3DWidget->syncToLayer( vlayer );
mWidgetStack->setMainPanel( mVector3DWidget );
break;
}

0 comments on commit aca8e03

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