src/objecttypes/errorline.cpp

Sun, 03 Nov 2019 12:56:42 +0200

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

added saving of splitter state and recent files

#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