Skip to content
Permalink
Browse files
add close button
  • Loading branch information
NEDJIMAbelgacem authored and nyalldawson committed Jan 12, 2022
1 parent 2887049 commit 8211fa020351636e3cc736a84631282ee35b372d
Showing with 56 additions and 29 deletions.
  1. +16 −1 src/app/3d/qgs3dviewsmanagerdialog.cpp
  2. +1 −0 src/app/3d/qgs3dviewsmanagerdialog.h
  3. +0 −2 src/app/qgisapp.cpp
  4. +39 −26 src/ui/3d/qgs3dviewsmanagerdialog.ui
@@ -33,6 +33,7 @@ Qgs3DViewsManagerDialog::Qgs3DViewsManagerDialog( QWidget *parent, Qt::WindowFla
m3DViewsListView->setSelectionMode( QAbstractItemView::SingleSelection );

connect( mOpenButton, &QToolButton::clicked, this, &Qgs3DViewsManagerDialog::openClicked );
connect( mCloseButton, &QToolButton::clicked, this, &Qgs3DViewsManagerDialog::closeClicked );
connect( mDuplicateButton, &QToolButton::clicked, this, &Qgs3DViewsManagerDialog::duplicateClicked );
connect( mRemoveButton, &QToolButton::clicked, this, &Qgs3DViewsManagerDialog::removeClicked );
connect( mRenameButton, &QToolButton::clicked, this, &Qgs3DViewsManagerDialog::renameClicked );
@@ -52,7 +53,7 @@ void Qgs3DViewsManagerDialog::openClicked()

QString viewName = m3DViewsListView->selectionModel()->selectedRows().at( 0 ).data( Qt::DisplayRole ).toString();

Qgs3DMapCanvasDockWidget *widget = QgisApp::instance()->findChild<Qgs3DMapCanvasDockWidget *>( viewName );
Qgs3DMapCanvasDockWidget *widget = QgisApp::instance()->findChild<Qgs3DMapCanvasDockWidget *>( viewName + QStringLiteral( "ViewObject" ) );
if ( !widget )
{
widget = QgisApp::instance()->open3DMapView( viewName );
@@ -65,6 +66,20 @@ void Qgs3DViewsManagerDialog::openClicked()
}
}

void Qgs3DViewsManagerDialog::closeClicked()
{
if ( m3DViewsListView->selectionModel()->selectedRows().isEmpty() )
return;

QString viewName = m3DViewsListView->selectionModel()->selectedRows().at( 0 ).data( Qt::DisplayRole ).toString();

Qgs3DMapCanvasDockWidget *widget = QgisApp::instance()->findChild<Qgs3DMapCanvasDockWidget *>( viewName + QStringLiteral( "ViewObject" ) );
if ( widget )
{
widget->close();
}
}

void Qgs3DViewsManagerDialog::duplicateClicked()
{
if ( m3DViewsListView->selectionModel()->selectedRows().isEmpty() )
@@ -35,6 +35,7 @@ class Qgs3DViewsManagerDialog : public QDialog, private Ui::Qgs3DViewsManagerDia

private slots:
void openClicked();
void closeClicked();
void duplicateClicked();
void removeClicked();
void renameClicked();
@@ -10118,7 +10118,6 @@ void QgisApp::populate3DMapviewsMenu( QMenu *menu )

void QgisApp::views3DMenuAboutToShow()
{
qDebug() << __PRETTY_FUNCTION__;
populate3DMapviewsMenu( m3DMapViewsMenu );
}

@@ -14014,7 +14013,6 @@ void QgisApp::new3DMapCanvas()
map->setSelectionColor( mMapCanvas->selectionColor() );
map->setBackgroundColor( mMapCanvas->canvasColor() );
map->setLayers( mMapCanvas->layers( true ) );
// map->setTerrainLayers( mMapCanvas->layers() );
map->setTemporalRange( mMapCanvas->temporalRange() );

const QgsCameraController::NavigationMode defaultNavMode = settings.enumValue( QStringLiteral( "map3d/defaultNavigation" ), QgsCameraController::TerrainBasedNavigation, QgsSettings::App );
@@ -6,25 +6,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>513</width>
<height>393</height>
<width>431</width>
<height>219</height>
</rect>
</property>
<property name="windowTitle">
<string>3D Map Views Manager</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="4">
<widget class="QListView" name="m3DViewsListView">
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
</item>
<item row="1" column="3">
<item row="2" column="4">
<widget class="QToolButton" name="mRenameButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -37,20 +27,30 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QToolButton" name="mOpenButton">
<item row="3" column="0" colspan="5">
<widget class="QDialogButtonBox" name="mButtonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::NoButton</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QToolButton" name="mCloseButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Open...</string>
<string>&amp;Close...</string>
</property>
</widget>
</item>
<item row="1" column="2">
<item row="2" column="2">
<widget class="QToolButton" name="mRemoveButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -63,26 +63,39 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="mDuplicateButton">
<item row="2" column="0">
<widget class="QToolButton" name="mOpenButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Duplicate…</string>
<string>&amp;Open...</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<widget class="QDialogButtonBox" name="mButtonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="0" column="0" colspan="5">
<widget class="QListView" name="m3DViewsListView">
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::NoButton</set>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QToolButton" name="mDuplicateButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Duplicate…</string>
</property>
</widget>
</item>

0 comments on commit 8211fa0

Please sign in to comment.