src/tools/selecttool.cpp

Sat, 24 Jul 2021 01:50:38 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 24 Jul 2021 01:50:38 +0300
changeset 107
02f142b399b1
parent 96
165777a20dc7
child 111
1f42c03fafca
permissions
-rw-r--r--

Move selection logic into select tool

#include "selecttool.h"

SelectTool::SelectTool(QObject* parent) :
	BaseTool{parent} {}

QString SelectTool::name() const
{
	static const QString result = tr("Select");
	return result;
}

QString SelectTool::toolTip() const
{
	static const QString result = tr("Select elements from the model.");
	return result;
}

bool SelectTool::mouseClick(const Canvas::MouseClickInfo& info)
{
	const ldraw::id_t highlighted = info.invoker->getHighlightedObject();
	info.invoker->clearSelection();
	if (highlighted != ldraw::NULL_ID)
	{
		info.invoker->addToSelection(highlighted);
	}
	return true;
}

mercurial