Skip to content

Commit

Permalink
add tooltip and raise dialog when undock toggled
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem committed Jan 14, 2022
1 parent becd7ed commit 74ac392
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/app/3d/qgs3dmapcanvaswidget.cpp
Expand Up @@ -137,6 +137,7 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( QWidget *parent )

mDockUnDockBtn = new QToolButton;
mDockUnDockBtn->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mDockify.svg" ) ) );
mDockUnDockBtn->setToolTip( QStringLiteral( "Dock 3D Map View" ) );
mDockUnDockBtn->setCheckable( true );
mDockUnDockBtn->setChecked( true );
mDockUnDockBtn->setEnabled( true );
Expand Down
22 changes: 10 additions & 12 deletions src/app/qgisapp.cpp
Expand Up @@ -9958,6 +9958,10 @@ QgsDockableWidget *QgisApp::duplicate3DMapView( const QString &existingViewName,
map->setTransformContext( QgsProject::instance()->transformContext() );
} );

if ( QgsDockWidget *dw = mapCanvasDock3D->dockWidget() )
{
setupDockWidget( dw, true );
}
}
else
{
Expand All @@ -9966,11 +9970,6 @@ QgsDockableWidget *QgisApp::duplicate3DMapView( const QString &existingViewName,
read3DMapViewSettings( mapCanvasDock3D, elem );
}

if ( QgsDockWidget *dw = mapCanvasDock3D->dockWidget() )
{
setupDockWidget( dw, true );
}

QDomElement elem3DMap;
elem3DMap = doc.createElement( QStringLiteral( "view" ) );
write3DMapViewSettings( mapCanvasDock3D, doc, elem3DMap );
Expand Down Expand Up @@ -16788,13 +16787,7 @@ void QgisApp::read3DMapViewSettings( QgsDockableWidget *w, QDomElement &elem3DMa
widget->animationWidget()->setAnimation( animationSettings );
}

if ( QgsDockWidget *dw = w->dockWidget() )
{
readDockWidgetSettings( dw, elem3DMap );
}

QDialog *d = w->dialog();
if ( d )
if ( QDialog *d = w->dialog() )
{
int dx = elem3DMap.attribute( QStringLiteral( "d_x" ), "0" ).toInt();
int dy = elem3DMap.attribute( QStringLiteral( "d_x" ), "0" ).toInt();
Expand All @@ -16805,6 +16798,11 @@ void QgisApp::read3DMapViewSettings( QgsDockableWidget *w, QDomElement &elem3DMa

bool isDocked = elem3DMap.attribute( QStringLiteral( "isDocked" ), "1" ).toInt() == 1;
dynamic_cast< Qgs3DMapCanvasWidget * >( w->widget() )->setDocked( isDocked );

if ( QgsDockWidget *dw = w->dockWidget() )
{
readDockWidgetSettings( dw, elem3DMap );
}
}
#endif

Expand Down
3 changes: 1 addition & 2 deletions src/app/qgsdockablewidget.cpp
Expand Up @@ -81,7 +81,6 @@ void QgsDockableWidget::toggleDockMode( bool docked )
// TODO: apply resizing in a better way
mDock->resize( mDock->size() + QSize( 1, 1 ) );
mDock->resize( mDock->size() - QSize( 1, 1 ) );

}
else
{
Expand All @@ -91,13 +90,13 @@ void QgsDockableWidget::toggleDockMode( bool docked )
mDialog->layout()->addWidget( mWidget );
mDock->setWidget( nullptr );

mDialog->raise();
mDialog->show();
mDock->setVisible( false );

// TODO: apply resizing in a better way
mDialog->resize( mDialog->size() + QSize( 1, 1 ) );
mDialog->resize( mDialog->size() - QSize( 1, 1 ) );

}
}

Expand Down

0 comments on commit 74ac392

Please sign in to comment.