qgs3dmapsettings: Store debug overlay enabled flag

This stores the debug overlay visibility flag (mIsDebugOverlayEnabled)
even if it cannot be used (it needs at least Qt version 5.15). Its
default value is set to false to prevent any issue if the debug
overlay cannot be enabled.
This parameter is transient: it is not saved in the project
parameters.

The next commit will allow to this change this setting with
Qgs3DMapConfigWidget.
This commit is contained in:
Jean Felder 2022-05-13 20:07:10 +02:00
parent 5209013897
commit a72dcb33fd
No known key found for this signature in database
GPG Key ID: 12722DC64D3F429E
3 changed files with 61 additions and 1 deletions

View File

@ -642,7 +642,26 @@ Sets whether the camera's view frustum is visualized on the 2D map canvas
.. versionadded:: 3.26
%End
bool isDebugOverlayEnabled() const;
%Docstring
Returns whether debug overlay is enabled
.. seealso:: :py:func:`setIsDebugOverlayEnabled`
.. versionadded:: 3.26
%End
void setIsDebugOverlayEnabled( bool debugOverlayEnabled );
%Docstring
Sets whether debug overlay is enabled
The debug overlay displays some debugging and profiling information.
It has been introduced in Qt version 5.15.
This parameter is transient. It is not saved in the project parameters.
.. seealso:: :py:func:`isDebugOverlayEnabled`
.. versionadded:: 3.26
%End
signals:
@ -871,6 +890,13 @@ Emitted when the camera's view frustum visualization on the main 2D map canvas i
%Docstring
Emitted when 3d axis rendering settings are changed
.. versionadded:: 3.26
%End
void debugOverlayEnabledChanged( bool debugOverlayEnabled );
%Docstring
Emitted when the debug overaly is enabled or disabled
.. versionadded:: 3.26
%End

View File

@ -92,7 +92,7 @@ Qgs3DMapSettings::Qgs3DMapSettings( const Qgs3DMapSettings &other )
, mTerrainRenderingEnabled( other.mTerrainRenderingEnabled )
, mRendererUsage( other.mRendererUsage )
, m3dAxisSettings( other.m3dAxisSettings )
, mIsDebugOverlayEnabled( other.mIsDebugOverlayEnabled )
{
for ( QgsAbstract3DRenderer *renderer : std::as_const( other.mRenderers ) )
{
@ -917,6 +917,15 @@ void Qgs3DMapSettings::setViewFrustumVisualizationEnabled( bool enabled )
}
}
void Qgs3DMapSettings::setIsDebugOverlayEnabled( bool debugOverlayEnabled )
{
if ( debugOverlayEnabled == mIsDebugOverlayEnabled )
return;
mIsDebugOverlayEnabled = debugOverlayEnabled;
emit debugOverlayEnabledChanged( mIsDebugOverlayEnabled );
}
void Qgs3DMapSettings::connectChangedSignalsToSettingsChanged()
{

View File

@ -640,6 +640,23 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject, public QgsTemporalRangeObjec
*/
void set3dAxisSettings( const Qgs3DAxisSettings &axisSettings ) SIP_SKIP;
/**
* Returns whether debug overlay is enabled
* \see setIsDebugOverlayEnabled()
* \since QGIS 3.26
*/
bool isDebugOverlayEnabled() const { return mIsDebugOverlayEnabled; }
/**
* Sets whether debug overlay is enabled
* The debug overlay displays some debugging and profiling information.
* It has been introduced in Qt version 5.15.
* This parameter is transient. It is not saved in the project parameters.
* \see isDebugOverlayEnabled()
* \since QGIS 3.26
*/
void setIsDebugOverlayEnabled( bool debugOverlayEnabled );
signals:
/**
@ -826,6 +843,12 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject, public QgsTemporalRangeObjec
*/
void axisSettingsChanged();
/**
* Emitted when the debug overaly is enabled or disabled
* \since QGIS 3.26
*/
void debugOverlayEnabledChanged( bool debugOverlayEnabled );
private:
#ifdef SIP_RUN
Qgs3DMapSettings &operator=( const Qgs3DMapSettings & );
@ -895,6 +918,8 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject, public QgsTemporalRangeObjec
Qgs3DAxisSettings m3dAxisSettings; //!< 3d axis related configuration
bool mIsDebugOverlayEnabled = false;
};