src/linetypes/errorline.cpp

Fri, 30 Jul 2021 01:28:39 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Fri, 30 Jul 2021 01:28:39 +0300
changeset 121
000781318c36
parent 86
4bec0525ef1b
child 132
488d0ba6070b
permissions
-rw-r--r--

added right click support for draw tool

#include <QBrush>
#include "errorline.h"

ldraw::ErrorLine::ErrorLine(QStringView text, QStringView message) :
	text{text.toString()},
	message{message.toString()}
{
}

QVariant ldraw::ErrorLine::getProperty(Property property) const
{
	switch (property)
	{
	case Property::Text:
		return this->text;
	case Property::ErrorMessage:
		return this->message;
	default:
		return Object::getProperty(property);
	}
}

void ldraw::ErrorLine::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair)
{
	LDRAW_OBJECT_HANDLE_SET_PROPERTY(Text, {this->text = value;});
	LDRAW_OBJECT_HANDLE_SET_PROPERTY(ErrorMessage, {this->message = value;});
	BaseClass::setProperty(result, pair);
}

QString ldraw::ErrorLine::textRepresentation() const
{
	return this->text;
}

QBrush ldraw::ErrorLine::textRepresentationForeground() const
{
	return QBrush{Qt::yellow};
}

QBrush ldraw::ErrorLine::textRepresentationBackground() const
{
	return QBrush{Qt::red};
}

mercurial