src/objecttypes/errorline.cpp

Thu, 03 Oct 2019 23:44:28 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 03 Oct 2019 23:44:28 +0300
changeset 6
73e448b2943d
parent 3
55a55a9ec2c2
child 8
44679e468ba9
permissions
-rw-r--r--

language support

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

modelobjects::ErrorLine::ErrorLine(QStringView text) :
	text{text.toString()}
{
}

QVariant modelobjects::ErrorLine::getProperty(Property property) const
{
	switch (property)
	{
	case Property::Text:
		return text;
	default:
		return BaseObject::getProperty(property);
	}
}

auto modelobjects::ErrorLine::setProperty(
	Property property,
	const QVariant& value)
	-> SetPropertyResult
{
	switch (property)
	{
	case Property::Text:
		text = value.toString();
		return SetPropertyResult::Success;
	default:
		return BaseObject::setProperty(property, value);
	}
}

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

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

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

mercurial