AbstractTool Class


Base class for classes that implement individual tools. More...

Public Functions

AbstractTool(QObject *parent = nullptr)
virtual bool handleClick(const Point &pos)
bool isActive() const
virtual void setActive(bool active)
virtual void setProperties(const QVariantMap &properties)
virtual QString toolName() const = 0


void activeChanged()
void errorOccurred(const Error &error)
void propertyChanged(const QString &propertyName, const QVariant &propertyValue)

Detailed Description

Base class for classes that implement individual tools.

AbstractTool provides functions and properties that all derived tools share.

Note: You cannot create an object of this class. Instead, create a tool object from a derived class.

Member Function Documentation

AbstractTool::AbstractTool(QObject *parent = nullptr)

The constructor that accepts an optional parent object.

[signal] void AbstractTool::activeChanged()

[signal] void AbstractTool::errorOccurred(const Error &error)

Signal emitted when this tool encounters an error.

  • error - Details about the error that occurred.

[virtual] bool AbstractTool::handleClick(const Point &pos)

Reimplement this method in subclasses to handle a click at geographic coordinate pos.

Returns false.

bool AbstractTool::isActive() const

Returns whether this tool is active (true) or not (false).

[signal] void AbstractTool::propertyChanged(const QString &propertyName, const QVariant &propertyValue)

Signal emitted when a property of this tool changes.

  • propertyName - The changed property's name.
  • propertyValue - The changed property's new value.

[virtual] void AbstractTool::setActive(bool active)

Sets whether this tool is active to active.

See also isActive() and activeChanged.

[virtual] void AbstractTool::setProperties(const QVariantMap &properties)

Reimplement this method in subclasses to set tool properties.

  • properties - A QVariantMap containing property settings.

A tool property is defined as a key-value pair where the key is a QString and the value is a QVariant. Properties are useful for general settings which you wish to persist for the tool, such as default modes.

[pure virtual] QString AbstractTool::toolName() const

Returns the name of this tool.

Feedback on this topic?