Skip to content

Commit 7064704

Browse files
committed
[3d] Have 3D View tab in vector layer properties (fixes #17595)
(only when 3D support is enabled)
1 parent 8ecae4f commit 7064704

3 files changed

+38
-0
lines changed

src/app/qgsvectorlayerproperties.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@
7979
#include "qgsrendererpropertiesdialog.h"
8080
#include "qgsstyle.h"
8181

82+
#ifdef HAVE_3D
83+
#include "qgsvectorlayer3drendererwidget.h"
84+
#endif
85+
86+
8287
QgsVectorLayerProperties::QgsVectorLayerProperties(
8388
QgsVectorLayer *lyr,
8489
QWidget *parent,
@@ -213,6 +218,15 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
213218
mAttributesFormFrame->layout()->setMargin( 0 );
214219
mAttributesFormFrame->layout()->addWidget( mAttributesFormPropertiesDialog );
215220

221+
#ifdef HAVE_3D
222+
mVector3DWidget = new QgsVectorLayer3DRendererWidget( mLayer, QgisApp::instance()->mapCanvas(), mOptsPage_3DView );
223+
224+
mOptsPage_3DView->setLayout( new QVBoxLayout( mOptsPage_3DView ) );
225+
mOptsPage_3DView->layout()->addWidget( mVector3DWidget );
226+
#else
227+
delete mOptsPage_3DView; // removes both the "3d view" list item and its page
228+
#endif
229+
216230
syncToLayer();
217231

218232
if ( mLayer->dataProvider() )//enable spatial index button group if supported by provider
@@ -527,6 +541,10 @@ void QgsVectorLayerProperties::syncToLayer()
527541
// set initial state for variable editor
528542
updateVariableEditor();
529543

544+
#ifdef HAVE_3D
545+
mVector3DWidget->setLayer( mLayer );
546+
#endif
547+
530548
} // syncToLayer()
531549

532550
void QgsVectorLayerProperties::apply()
@@ -712,6 +730,10 @@ void QgsVectorLayerProperties::apply()
712730
QMessageBox::warning( nullptr, tr( "Dependency cycle" ), tr( "This configuration introduces a cycle in data dependencies and will be ignored" ) );
713731
}
714732

733+
#ifdef HAVE_3D
734+
mVector3DWidget->apply();
735+
#endif
736+
715737
// update symbology
716738
emit refreshLegend( mLayer->id() );
717739

src/app/qgsvectorlayerproperties.h

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class QgsMapLayerConfigWidgetFactory;
4545
class QgsMapLayerConfigWidget;
4646
class QgsMetadataWidget;
4747
class QgsPanelWidget;
48+
class QgsVectorLayer3DRendererWidget;
4849

4950
class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private Ui::QgsVectorLayerPropertiesBase, private QgsExpressionContextGenerator
5051
{
@@ -237,6 +238,8 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
237238
QAction *mAuxiliaryLayerActionDeleteField = nullptr;
238239
QAction *mAuxiliaryLayerActionAddField = nullptr;
239240

241+
QgsVectorLayer3DRendererWidget *mVector3DWidget = nullptr;
242+
240243
private slots:
241244
void openPanel( QgsPanelWidget *panel );
242245
};

src/ui/qgsvectorlayerpropertiesbase.ui

+13
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,18 @@
153153
<normaloff>:/images/themes/default/propertyicons/labels.svg</normaloff>:/images/themes/default/propertyicons/labels.svg</iconset>
154154
</property>
155155
</item>
156+
<item>
157+
<property name="text">
158+
<string>3D View</string>
159+
</property>
160+
<property name="toolTip">
161+
<string>3D View</string>
162+
</property>
163+
<property name="icon">
164+
<iconset resource="../../images/images.qrc">
165+
<normaloff>:/images/themes/default/3d.svg</normaloff>:/images/themes/default/3d.svg</iconset>
166+
</property>
167+
</item>
156168
<item>
157169
<property name="text">
158170
<string>Source Fields</string>
@@ -784,6 +796,7 @@ border-radius: 2px;</string>
784796
</item>
785797
</layout>
786798
</widget>
799+
<widget class="QWidget" name="mOptsPage_3DView"/>
787800
<widget class="QWidget" name="mOptsPage_SourceFields">
788801
<layout class="QVBoxLayout" name="verticalLayout_29">
789802
<property name="leftMargin">

0 commit comments

Comments
 (0)