Files

59 lines
845 B
C++
Raw Permalink Normal View History

2016-05-31 23:22:03 +02:00
#include "TextSourceDataModel.hpp"
TextSourceDataModel::
TextSourceDataModel()
: _lineEdit(new QLineEdit("Default Text"))
{
connect(_lineEdit, &QLineEdit::textEdited,
this, &TextSourceDataModel::onTextEdited);
2016-05-31 23:22:03 +02:00
}
unsigned int
TextSourceDataModel::
2016-06-05 22:16:43 +02:00
nPorts(PortType portType) const
2016-05-31 23:22:03 +02:00
{
unsigned int result = 1;
switch (portType)
{
case PortType::In:
2016-05-31 23:22:03 +02:00
result = 0;
break;
case PortType::Out:
2016-05-31 23:22:03 +02:00
result = 1;
default:
break;
}
return result;
}
void
TextSourceDataModel::
onTextEdited(QString const &string)
{
Q_UNUSED(string);
emit dataUpdated(0);
}
NodeDataType
TextSourceDataModel::
dataType(PortType, PortIndex) const
{
return TextData().type();
}
2016-05-31 23:22:03 +02:00
std::shared_ptr<NodeData>
TextSourceDataModel::
outData(PortIndex)
2016-05-31 23:22:03 +02:00
{
return std::make_shared<TextData>(_lineEdit->text());
2016-05-31 23:22:03 +02:00
}