src/objecttypes/errorline.cpp

Sun, 03 Nov 2019 12:17:41 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 03 Nov 2019 12:17:41 +0200
changeset 8
44679e468ba9
parent 6
73e448b2943d
child 13
6e838748867b
permissions
-rw-r--r--

major update with many things

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

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

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

auto modelobjects::ErrorLine::setProperty(
	Property property,
	const QVariant& value)
	-> SetPropertyResult
{
	switch (property)
	{
	case Property::Text:
		this->text = value.toString();
		return SetPropertyResult::Success;
	case Property::ErrorMessage:
		this->message = 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