You've already forked nodeeditor
mirror of
https://github.com/AxioDL/nodeeditor.git
synced 2026-03-30 11:48:31 -07:00
Merge branch 'master' into multinode
This commit is contained in:
@@ -22,7 +22,32 @@ public:
|
||||
QString
|
||||
caption() const override
|
||||
{ return QString("Division"); }
|
||||
|
||||
virtual bool
|
||||
portCaptionVisible(PortType portType, PortIndex portIndex) const override
|
||||
{ return true; }
|
||||
|
||||
virtual QString
|
||||
portCaption(PortType portType, PortIndex portIndex) const override
|
||||
{
|
||||
switch (portType)
|
||||
{
|
||||
case PortType::In:
|
||||
if (portIndex == 0)
|
||||
return QString("Dividend");
|
||||
else if (portIndex == 1)
|
||||
return QString("Divisor");
|
||||
break;
|
||||
|
||||
case PortType::Out:
|
||||
return QString("Result");
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QString("");
|
||||
}
|
||||
|
||||
QString
|
||||
name() const override
|
||||
{ return QString("Division"); }
|
||||
|
||||
@@ -24,6 +24,31 @@ public:
|
||||
caption() const override
|
||||
{ return QString("Subtraction"); }
|
||||
|
||||
virtual bool
|
||||
portCaptionVisible(PortType portType, PortIndex portIndex) const override
|
||||
{ return true; }
|
||||
|
||||
virtual QString
|
||||
portCaption(PortType portType, PortIndex portIndex) const override
|
||||
{
|
||||
switch (portType)
|
||||
{
|
||||
case PortType::In:
|
||||
if (portIndex == 0)
|
||||
return QString("Minuend");
|
||||
else if (portIndex == 1)
|
||||
return QString("Subtrahend");
|
||||
break;
|
||||
|
||||
case PortType::Out:
|
||||
return QString("Result");
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QString("");
|
||||
}
|
||||
|
||||
QString
|
||||
name() const override
|
||||
{ return QString("Subtraction"); }
|
||||
|
||||
@@ -29,6 +29,14 @@ public:
|
||||
virtual bool
|
||||
captionVisible() const { return true; }
|
||||
|
||||
/// Port caption is used in GUI to label individual ports
|
||||
virtual QString
|
||||
portCaption(PortType portType, PortIndex portIndex) const { return QString(""); }
|
||||
|
||||
/// It is possible to hide port caption in GUI
|
||||
virtual bool
|
||||
portCaptionVisible(PortType portType, PortIndex portIndex) const { return false; }
|
||||
|
||||
/// Name makes this model unique
|
||||
virtual QString
|
||||
name() const = 0;
|
||||
|
||||
@@ -256,7 +256,13 @@ portWidth(PortType portType) const
|
||||
|
||||
for (auto i = 0ul; i < _dataModel->nPorts(portType); ++i)
|
||||
{
|
||||
auto const &name = _dataModel->dataType(PortType::In, i).name;
|
||||
QString name;
|
||||
|
||||
if (_dataModel->portCaptionVisible(portType, i))
|
||||
name = _dataModel->portCaption(portType, i);
|
||||
else
|
||||
name = _dataModel->dataType(portType, i).name;
|
||||
|
||||
width = std::max(unsigned(_fontMetrics.width(name)),
|
||||
width);
|
||||
}
|
||||
|
||||
+6
-1
@@ -271,7 +271,12 @@ drawEntryLabels(QPainter * painter,
|
||||
else
|
||||
painter->setPen(nodeStyle.FontColor);
|
||||
|
||||
QString s = model->dataType(portType, i).name;
|
||||
QString s;
|
||||
|
||||
if (model->portCaptionVisible(portType, i))
|
||||
s = model->portCaption(portType, i);
|
||||
else
|
||||
s = model->dataType(portType, i).name;
|
||||
|
||||
auto rect = metrics.boundingRect(s);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user