Skip to content

Commit

Permalink
Do not reuse property signals
Browse files Browse the repository at this point in the history
  • Loading branch information
tanneryould committed Oct 23, 2024
1 parent 08382f8 commit 3d5755e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
23 changes: 13 additions & 10 deletions CppSamples/DisplayInformation/ShowGrid/ShowGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void ShowGrid::setMapView(MapQuickView* mapView)

m_mapView->setGrid(m_grid);

emit viewChanged();
emit mapViewChanged();
}

SceneQuickView* ShowGrid::sceneView() const
Expand All @@ -112,7 +112,7 @@ void ShowGrid::setSceneView(SceneQuickView* sceneView)
// Set the SceneView initially to be invisible
m_sceneView->setVisible(false);

emit viewChanged();
emit sceneViewChanged();
}


Expand Down Expand Up @@ -144,7 +144,7 @@ void ShowGrid::setViewType(const QString& viewType)
m_sceneView->setGrid(m_grid);
}

emit propertiesChanged();
emit viewTypeChanged();
}

void ShowGrid::setGridType(const QString& gridType)
Expand Down Expand Up @@ -183,6 +183,8 @@ void ShowGrid::setGridType(const QString& gridType)
setLabelColor(m_currentLabelColor);
setLabelPosition(m_currentLabelPosition);
setLabelFormat(m_currentLabelFormat);

emit gridTypeChanged();
}

void ShowGrid::setGridVisible(bool visible)
Expand All @@ -193,7 +195,7 @@ void ShowGrid::setGridVisible(bool visible)
m_gridVisible = visible;
m_grid->setVisible(visible);

emit propertiesChanged();
emit gridVisibleChanged();
}

void ShowGrid::setLabelsVisible(bool visible)
Expand All @@ -204,7 +206,7 @@ void ShowGrid::setLabelsVisible(bool visible)
m_labelsVisible = visible;
m_grid->setLabelsVisible(visible);

emit propertiesChanged();
emit labelsVisibleChanged();
}

void ShowGrid::setLineColor(const QString& lineColor)
Expand All @@ -218,7 +220,7 @@ void ShowGrid::setLineColor(const QString& lineColor)
for (int level = 0; level < m_grid->levelCount(); ++level)
m_grid->setLineSymbol(level, lineSymbol);

emit propertiesChanged();
emit lineColorChanged();
}

void ShowGrid::setLabelColor(const QString& labelColor)
Expand All @@ -232,7 +234,7 @@ void ShowGrid::setLabelColor(const QString& labelColor)
for (int level = 0; level < m_grid->levelCount(); ++level)
m_grid->setTextSymbol(level, labelSymbol);

emit propertiesChanged();
emit labelColorChanged();
}

void ShowGrid::setLabelPosition(const QString& labelPosition)
Expand All @@ -254,20 +256,21 @@ void ShowGrid::setLabelPosition(const QString& labelPosition)
else if (labelPosition == s_allSides)
m_grid->setLabelPosition(GridLabelPosition::AllSides);

emit propertiesChanged();
emit labelPositionChanged();
}

void ShowGrid::setLabelFormat(const QString& labelFormat)
{
m_currentLabelFormat = labelFormat;

// Only LatitudeLongitudeGrid supports label formats
if (m_grid->gridType() != GridType::LatitudeLongitudeGrid)
return;

m_currentLabelFormat = labelFormat;
if (labelFormat == s_decimalDegrees)
static_cast<LatitudeLongitudeGrid*>(m_grid)->setLabelFormat(LatitudeLongitudeGridLabelFormat::DecimalDegrees);
else if (labelFormat == s_degreesMinutesSeconds)
static_cast<LatitudeLongitudeGrid*>(m_grid)->setLabelFormat(LatitudeLongitudeGridLabelFormat::DegreesMinutesSeconds);

emit propertiesChanged();
emit labelFormatChanged();
}
32 changes: 20 additions & 12 deletions CppSamples/DisplayInformation/ShowGrid/ShowGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ class ShowGrid : public QObject
{
Q_OBJECT

Q_PROPERTY(Esri::ArcGISRuntime::MapQuickView* mapView READ mapView WRITE setMapView NOTIFY viewChanged)
Q_PROPERTY(Esri::ArcGISRuntime::SceneQuickView* sceneView READ sceneView WRITE setSceneView NOTIFY viewChanged)
Q_PROPERTY(QString currentViewType MEMBER m_currentViewType NOTIFY propertiesChanged)
Q_PROPERTY(Esri::ArcGISRuntime::MapQuickView* mapView READ mapView WRITE setMapView NOTIFY mapViewChanged)
Q_PROPERTY(Esri::ArcGISRuntime::SceneQuickView* sceneView READ sceneView WRITE setSceneView NOTIFY sceneViewChanged)
Q_PROPERTY(QString currentViewType MEMBER m_currentViewType NOTIFY viewTypeChanged)
Q_PROPERTY(QStringList viewTypes MEMBER m_viewTypes CONSTANT)
Q_PROPERTY(QString currentGridType MEMBER m_currentGridType NOTIFY propertiesChanged)
Q_PROPERTY(QString currentGridType MEMBER m_currentGridType NOTIFY gridTypeChanged)
Q_PROPERTY(QStringList gridTypes MEMBER m_gridTypes CONSTANT)
Q_PROPERTY(bool gridVisible MEMBER m_gridVisible NOTIFY propertiesChanged)
Q_PROPERTY(bool labelsVisible MEMBER m_labelsVisible NOTIFY propertiesChanged)
Q_PROPERTY(QString currentLineColor MEMBER m_currentLineColor NOTIFY propertiesChanged)
Q_PROPERTY(bool gridVisible MEMBER m_gridVisible NOTIFY gridVisibleChanged)
Q_PROPERTY(bool labelsVisible MEMBER m_labelsVisible NOTIFY labelsVisibleChanged)
Q_PROPERTY(QString currentLineColor MEMBER m_currentLineColor NOTIFY lineColorChanged)
Q_PROPERTY(QStringList lineColors MEMBER m_lineColors CONSTANT)
Q_PROPERTY(QString currentLabelColor MEMBER m_currentLabelColor NOTIFY propertiesChanged)
Q_PROPERTY(QString currentLabelColor MEMBER m_currentLabelColor NOTIFY labelColorChanged)
Q_PROPERTY(QStringList labelColors MEMBER m_labelColors CONSTANT)
Q_PROPERTY(QString currentLabelPosition MEMBER m_currentLabelPosition NOTIFY propertiesChanged)
Q_PROPERTY(QString currentLabelPosition MEMBER m_currentLabelPosition NOTIFY labelPositionChanged)
Q_PROPERTY(QStringList labelFormats MEMBER m_labelFormats CONSTANT)
Q_PROPERTY(QString currentLabelFormat MEMBER m_currentLabelFormat NOTIFY propertiesChanged)
Q_PROPERTY(QString currentLabelFormat MEMBER m_currentLabelFormat NOTIFY labelFormatChanged)
Q_PROPERTY(QStringList labelPositions MEMBER m_labelPositions CONSTANT)

public:
Expand All @@ -70,8 +70,16 @@ class ShowGrid : public QObject
Q_INVOKABLE void setLabelFormat(const QString& labelFormat);

signals:
void viewChanged();
void propertiesChanged();
void mapViewChanged();
void sceneViewChanged();
void viewTypeChanged();
void gridTypeChanged();
void gridVisibleChanged();
void labelsVisibleChanged();
void lineColorChanged();
void labelColorChanged();
void labelPositionChanged();
void labelFormatChanged();

private:
// Declare private methods
Expand Down

0 comments on commit 3d5755e

Please sign in to comment.