Skip to content
Permalink
Browse files

Move QgsVectorLayerProperties and dependencies to GUI

  • Loading branch information
manisandro committed Mar 9, 2020
1 parent 0f22920 commit 84bd5797f784b7758ae66e42010abb27e464987b
Showing with 854 additions and 550 deletions.
  1. +1 −0 python/CMakeLists.txt
  2. +2 −0 python/gui/auto_additions/qgsrasterlayerproperties.py
  3. +7 −0 python/gui/auto_generated/qgsmaplayerconfigwidget.sip.in
  4. +54 −0 python/gui/auto_generated/vector/qgsvectorlayerproperties.sip.in
  5. +1 −0 python/gui/gui_auto.sip
  6. +29 −5 src/app/3d/qgsvectorlayer3drendererwidget.cpp
  7. +16 −2 src/app/3d/qgsvectorlayer3drendererwidget.h
  8. +3 −28 src/app/CMakeLists.txt
  9. +22 −1 src/app/qgisapp.cpp
  10. +2 −2 src/app/qgsappscreenshots.cpp
  11. +1 −1 src/app/qgslayerstylingwidget.cpp
  12. +182 −0 src/app/qgsvectorlayerdigitizingproperties.cpp
  13. +60 −0 src/app/qgsvectorlayerdigitizingproperties.h
  14. +59 −0 src/gui/CMakeLists.txt
  15. 0 src/{app → gui}/attributeformconfig/qgsattributeformcontaineredit.cpp
  16. +6 −2 src/{app → gui}/attributeformconfig/qgsattributeformcontaineredit.h
  17. 0 src/{app → gui}/attributeformconfig/qgsattributerelationedit.cpp
  18. +5 −2 src/{app → gui}/attributeformconfig/qgsattributerelationedit.h
  19. +0 −1 src/{app → gui}/attributeformconfig/qgsattributetypedialog.cpp
  20. +5 −2 src/{app → gui}/attributeformconfig/qgsattributetypedialog.h
  21. 0 src/{app → gui}/attributeformconfig/qgsattributewidgetedit.cpp
  22. +6 −2 src/{app → gui}/attributeformconfig/qgsattributewidgetedit.h
  23. +8 −6 src/{app → gui}/labeling/qgslabelengineconfigdialog.cpp
  24. +10 −5 src/{app → gui}/labeling/qgslabelengineconfigdialog.h
  25. +4 −4 src/{app → gui}/labeling/qgslabelingwidget.cpp
  26. +5 −1 src/{app → gui}/labeling/qgslabelingwidget.h
  27. 0 src/{app → gui}/labeling/qgsrulebasedlabelingwidget.cpp
  28. +7 −4 src/{app → gui}/labeling/qgsrulebasedlabelingwidget.h
  29. 0 src/{app → gui}/qgsaddattrdialog.cpp
  30. +5 −2 src/{app → gui}/qgsaddattrdialog.h
  31. +0 −1 src/{app → gui}/qgsaddtaborgroup.cpp
  32. +5 −2 src/{app → gui}/qgsaddtaborgroup.h
  33. +6 −0 src/gui/qgsmaplayerconfigwidget.h
  34. 0 src/{app → gui}/qgsmaplayerstylecategoriesmodel.cpp
  35. +5 −1 src/{app → gui}/qgsmaplayerstylecategoriesmodel.h
  36. +1 −2 src/{app → gui}/qgsmaskingwidget.cpp
  37. +4 −1 src/{app → gui}/qgsmaskingwidget.h
  38. 0 src/{app → gui}/qgsmasksourceselectionwidget.cpp
  39. +4 −1 src/{app → gui}/qgsmasksourceselectionwidget.h
  40. 0 src/{app → gui}/qgssymbollayerselectionwidget.cpp
  41. +5 −2 src/{app → gui}/qgssymbollayerselectionwidget.h
  42. +0 −1 src/{app → gui/vector}/qgsattributeactiondialog.cpp
  43. +5 −2 src/{app → gui/vector}/qgsattributeactiondialog.h
  44. +0 −1 src/{app → gui/vector}/qgsattributeactionpropertiesdialog.cpp
  45. +5 −1 src/{app → gui/vector}/qgsattributeactionpropertiesdialog.h
  46. 0 src/{app → gui/vector}/qgsattributesforminitcode.cpp
  47. +5 −2 src/{app → gui/vector}/qgsattributesforminitcode.h
  48. +20 −20 src/{app → gui/vector}/qgsattributesformproperties.cpp
  49. +14 −13 src/{app → gui/vector}/qgsattributesformproperties.h
  50. +18 −7 src/{app → gui/vector}/qgsdiagramproperties.cpp
  51. +5 −15 src/{app → gui/vector}/qgsdiagramproperties.h
  52. +0 −1 src/{app → gui/vector}/qgsfieldcalculator.cpp
  53. +5 −2 src/{app → gui/vector}/qgsfieldcalculator.h
  54. 0 src/{app → gui/vector}/qgsjoindialog.cpp
  55. +5 −2 src/{app → gui/vector}/qgsjoindialog.h
  56. +1 −0 src/{app → gui/vector}/qgssourcefieldsproperties.cpp
  57. +5 −3 src/{app → gui/vector}/qgssourcefieldsproperties.h
  58. 0 src/{app → gui/vector}/qgsvectorlayerlegendwidget.cpp
  59. +5 −1 src/{app → gui/vector}/qgsvectorlayerlegendwidget.h
  60. +3 −4 src/{app → gui/vector}/qgsvectorlayerloadstyledialog.cpp
  61. +5 −2 src/{app → gui/vector}/qgsvectorlayerloadstyledialog.h
  62. +33 −177 src/{app → gui/vector}/qgsvectorlayerproperties.cpp
  63. +16 −43 src/{app → gui/vector}/qgsvectorlayerproperties.h
  64. 0 src/{app → gui/vector}/qgsvectorlayersavestyledialog.cpp
  65. +5 −1 src/{app → gui/vector}/qgsvectorlayersavestyledialog.h
  66. 0 src/{app → gui/vector}/qgswmsdimensiondialog.cpp
  67. +5 −2 src/{app → gui/vector}/qgswmsdimensiondialog.h
  68. +129 −0 src/ui/qgsvectorlayerdigitizingproperties.ui
  69. +34 −170 src/ui/qgsvectorlayerpropertiesbase.ui
  70. +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
)
@@ -0,0 +1,2 @@
# The following has been generated automatically from src/gui/raster/qgsrasterlayerproperties.h
QgsRasterLayerProperties.StyleType.baseClass = QgsRasterLayerProperties
@@ -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 *
************************************************************************/
@@ -329,6 +329,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;
}

1 comment on commit 84bd579

@PeterPetrik

This comment has been minimized.

Copy link
Contributor

@PeterPetrik PeterPetrik commented on 84bd579 Mar 10, 2020

@manisandro this broke the MacOS nightly builds due to missing include directory

 [ 72%] Building CXX object src/gui/CMakeFiles/qgis_gui.dir/labeling/qgslabelinggui.cpp.o
In file included from /Users/admin/qgis/builds/nightly/qgis/src/gui/labeling/qgslabelengineconfigdialog.cpp:19:
In file included from /Users/admin/qgis/builds/nightly/qgis/src/core/pal/pal.h:38:
/Users/admin/qgis/builds/nightly/qgis/src/core/geometry/qgsgeos.h:24:10: fatal error: 'geos_c.h' file not found
#include <geos_c.h>
         ^~~~~~~~~~
Please sign in to comment.
You can’t perform that action at this time.