Skip to content

Commit a52b89f

Browse files
authored
Merge pull request #301 from Esri/james/v.next/setSettingsEarlier
Allow users to know when tools are added
2 parents 6f05f3a + 2cf80b3 commit a52b89f

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

Plugin/CppApi/ArcGISRuntimeToolkit_StaticLib.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
################################################################################
1616

17-
# this is identical to the included project except it produces a statib library
17+
# this is identical to the included project except it produces a static library
1818
# rather than a dynamic library
1919

2020
CONFIG += staticlib

Plugin/CppApi/include/ToolManager.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ namespace Toolkit
3232

3333
class AbstractTool;
3434

35-
class TOOLKIT_EXPORT ToolManager {
35+
class TOOLKIT_EXPORT ToolManager : public QObject
36+
{
37+
Q_OBJECT
3638

3739
using ToolsList = QMap<QString, AbstractTool*>;
3840

@@ -61,6 +63,10 @@ class TOOLKIT_EXPORT ToolManager {
6163
ToolsList::const_iterator begin() const;
6264
ToolsList::const_iterator end() const;
6365

66+
signals:
67+
void toolAdded(Esri::ArcGISRuntime::Toolkit::AbstractTool* tool);
68+
void toolRemoved(const QString& toolName);
69+
6470
private:
6571
ToolManager();
6672

Plugin/CppApi/source/ToolManager.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ void ToolManager::addTool(AbstractTool* tool)
6868
});
6969

7070
m_tools.insert(tool->toolName(), tool);
71+
emit toolAdded(tool);
7172
}
7273

7374
/*! \brief Removes the \l AbstractTool called \a toolName from the manager.
@@ -90,6 +91,7 @@ void ToolManager::removeTool(AbstractTool* tool)
9091
{
9192
if (it.value() == tool)
9293
{
94+
emit toolRemoved(it.key());
9395
m_tools.erase(it);
9496
return;
9597
}
@@ -144,6 +146,28 @@ ToolManager::ToolsList::const_iterator ToolManager::end() const
144146
return m_tools.cend();
145147
}
146148

149+
/*!
150+
\fn void ToolManager::toolAdded(Esri::ArcGISRuntime::Toolkit::AbstractTool* tool);
151+
\brief The signal emitted when a tool has been added to the ToolManager.
152+
153+
\list
154+
\li \a tool - The tool that was added.
155+
\endlist
156+
*/
157+
158+
/*!
159+
\fn void ToolManager::toolRemoved(const QString& toolName);
160+
\brief The signal emitted when a tool has been removed from the ToolManager.
161+
162+
\list
163+
\li \a toolName - The name of the tool that was removed.
164+
\endlist
165+
166+
The name of the tool is provided instead of a pointer to the tool
167+
like with \l toolAdded. This is for safety since the pointer may
168+
be invalid when the tool has been removed.
169+
*/
170+
147171
} // Toolkit
148172
} // ArcGISRuntime
149173
} // Esri

0 commit comments

Comments
 (0)