Add minor UI improvements

Debug camera info is always shown
Debug depth map widget's default position is moved to bottom left
corner, so it won't collide with axis widget
Docking icon is moved to the last position
Toolbar icon size is finally correct, changes with the window docked state as
it should
This commit is contained in:
Withalion 2024-11-18 13:04:31 +01:00 committed by Martin Dobias
parent edac3f7f7b
commit 7292ba50f8
4 changed files with 22 additions and 33 deletions

View File

@ -995,7 +995,7 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject, public QgsTemporalRangeObjec
double mDebugShadowMapSize = 0.2; double mDebugShadowMapSize = 0.2;
bool mDebugDepthMapEnabled = false; bool mDebugDepthMapEnabled = false;
Qt::Corner mDebugDepthMapCorner = Qt::Corner::TopRightCorner; Qt::Corner mDebugDepthMapCorner = Qt::Corner::BottomLeftCorner;
double mDebugDepthMapSize = 0.2; double mDebugDepthMapSize = 0.2;
bool mTerrainRenderingEnabled = true; bool mTerrainRenderingEnabled = true;

View File

@ -57,21 +57,6 @@ Qgs3DDebugWidget::Qgs3DDebugWidget( Qgs3DMapCanvas *canvas, QWidget *parent ) :
mLookingX->setRange( std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max() ); mLookingX->setRange( std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max() );
mLookingY->setRange( std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max() ); mLookingY->setRange( std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max() );
mLookingZ->setRange( std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max() ); mLookingZ->setRange( std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max() );
// hide camera info on first render
for ( QWidget *childWidget : mCameraInfoGroupBox->findChildren<QWidget *>() )
{
childWidget->setVisible( false );
}
// hide or show camera info on toggle
connect( mCameraInfoGroupBox, &QGroupBox::toggled, this, [ = ]( const bool enabled )
{
for ( QWidget *childWidget : mCameraInfoGroupBox->findChildren<QWidget *>() )
{
childWidget->setVisible( enabled );
}
} );
} }
/** /**

View File

@ -66,7 +66,7 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked )
const QgsSettings setting; const QgsSettings setting;
QToolBar *toolBar = new QToolBar( this ); QToolBar *toolBar = new QToolBar( this );
toolBar->setIconSize( QgisApp::instance()->iconSize( true ) ); toolBar->setIconSize( QgisApp::instance()->iconSize( isDocked ) );
QAction *actionCameraControl = toolBar->addAction( QIcon( QgsApplication::iconPath( "mActionPan.svg" ) ), QAction *actionCameraControl = toolBar->addAction( QIcon( QgsApplication::iconPath( "mActionPan.svg" ) ),
tr( "Camera Control" ), this, &Qgs3DMapCanvasWidget::cameraControl ); tr( "Camera Control" ), this, &Qgs3DMapCanvasWidget::cameraControl );
@ -308,6 +308,19 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked )
onTotalPendingJobsCountChanged(); onTotalPendingJobsCountChanged();
QAction *toggleDebugPanel = toolBar->addAction(
QgsApplication::getThemeIcon( QStringLiteral( "/propertyicons/general.svg" ) ),
tr( "Toggle On-Screen Debug Information" ) );
toggleDebugPanel->setCheckable( true );
toggleDebugPanel->setChecked(
setting.value( QStringLiteral( "/3D/debugWidget/visibility" ), false, QgsSettings::Gui ).toBool()
);
toggleDebugWidget(
setting.value( QStringLiteral( "/3D/debugWidget/visibility" ), false, QgsSettings::Gui ).toBool()
);
connect( toggleDebugPanel, &QAction::toggled, this, &Qgs3DMapCanvasWidget::toggleDebugWidget );
mDockableWidgetHelper = new QgsDockableWidgetHelper( isDocked, mCanvasName, this, QgisApp::instance() ); mDockableWidgetHelper = new QgsDockableWidgetHelper( isDocked, mCanvasName, this, QgisApp::instance() );
if ( QDialog *dialog = mDockableWidgetHelper->dialog() ) if ( QDialog *dialog = mDockableWidgetHelper->dialog() )
{ {
@ -321,19 +334,10 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked )
{ {
QgisApp::instance()->close3DMapView( canvasName() ); QgisApp::instance()->close3DMapView( canvasName() );
} ); } );
connect( dockAction, &QAction::toggled, this, [ = ]( const bool isSmallSize )
QAction *toggleDebugPanel = toolBar->addAction( {
QgsApplication::getThemeIcon( QStringLiteral( "/propertyicons/general.svg" ) ), toolBar->setIconSize( QgisApp::instance()->iconSize( isSmallSize ) );
tr( "Toggle On-Screen Debug Information" ) ); } );
toggleDebugPanel->setCheckable( true );
toggleDebugPanel->setChecked(
setting.value( QStringLiteral( "/3D/debugWidget/visibility" ), false, QgsSettings::Gui ).toBool()
);
toggleDebugWidget(
setting.value( QStringLiteral( "/3D/debugWidget/visibility" ), false, QgsSettings::Gui ).toBool()
);
connect( toggleDebugPanel, &QAction::toggled, this, &Qgs3DMapCanvasWidget::toggleDebugWidget );
} }
Qgs3DMapCanvasWidget::~Qgs3DMapCanvasWidget() Qgs3DMapCanvasWidget::~Qgs3DMapCanvasWidget()

View File

@ -44,9 +44,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>-295</y>
<width>250</width> <width>250</width>
<height>792</height> <height>790</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -214,7 +214,7 @@
<string>Show camera info</string> <string>Show camera info</string>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="checked"> <property name="checked">
<bool>false</bool> <bool>false</bool>