Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 641c4bf

Browse files
ptitjanogithub-actions[bot]
authored andcommittedOct 10, 2023
qgs3daxissettings: Correctly read viewport ratio on a saved project
When loading a project which contains a 3D view, the 3D axis is not visible even when it is supposed to be displayed. This is because the min and max viewport ratio settings are always equal to 0 on a saved project. Indeed, these settings are supposed to handle the 3D axis visibility when the 3D view size changes: the axis are hidden when the view becomes too small. These ratio are stored as double between 0 and 1. However, the logic which reads these parameters from a saved project (`Qgs3DAxisSettings::readXml`) parses them as integer. Therefore, the min and max ratio are always equal to 0. Then, the 3D axis visibility test is always false and the 3D axis are always hidden. This issue is fixed by changing `Qgs3DAxisSettings::readXml` to read the ratios as double.
1 parent ac37571 commit 641c4bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/3d/qgs3daxissettings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ void Qgs3DAxisSettings::readXml( const QDomElement &element, const QgsReadWriteC
5858

5959
sizeStr = element.attribute( QStringLiteral( "minViewportRatio" ) );
6060
if ( !sizeStr.isEmpty() )
61-
mMinViewportRatio = sizeStr.toInt();
61+
mMinViewportRatio = sizeStr.toDouble();
6262

6363
sizeStr = element.attribute( QStringLiteral( "maxViewportRatio" ) );
6464
if ( !sizeStr.isEmpty() )
65-
mMaxViewportRatio = sizeStr.toInt();
65+
mMaxViewportRatio = sizeStr.toDouble();
6666

6767
const QString modeStr = element.attribute( QStringLiteral( "mode" ) );
6868
if ( modeStr == QLatin1String( "Off" ) )

0 commit comments

Comments
 (0)
Please sign in to comment.