src/tools/selecttool.cpp

Sun, 25 Jul 2021 20:39:21 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 25 Jul 2021 20:39:21 +0300
changeset 112
5760cbb32bc0
parent 111
1f42c03fafca
child 121
000781318c36
permissions
-rw-r--r--

use QT_NO_KEYWORDS

#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(Document* document, Canvas* canvas)
{
	static_cast<void>(document);
	const ldraw::id_t highlighted = canvas->getHighlightedObject();
	canvas->clearSelection();
	if (highlighted != ldraw::NULL_ID)
	{
		canvas->addToSelection(highlighted);
	}
	return true;
}

mercurial