17const qreal VuoRendererTypecastPort::textPadding = 7 ;
32 replacedPort->getRefreshPort(),
35 this->replacedPort = replacedPort;
37 setUncollapsedTypecastNode(uncollapsedTypecastNode);
44void VuoRendererTypecastPort::setUncollapsedTypecastNode(
VuoRendererNode *uncollapsedTypecastNode)
52 this->uncollapsedTypecastNode = uncollapsedTypecastNode;
56 updateCachedBoundingRect();
67 if (includeNormalPort)
101QString VuoRendererTypecastPort::getCanvasTypecastTitle(
void)
const
114 string typecastClassName = typecastClass->
getClassName();
117 map<string, string> customTypecastTitles;
118 customTypecastTitles[
"vuo.type.real.boolean"] =
"Real ≠ 0";
119 customTypecastTitles[
"vuo.type.real.enum.VuoBoolean"] =
"Real ≥ 0.5";
121 map<string, string>::iterator typecastTitle = customTypecastTitles.find(typecastClassName);
122 if (typecastTitle != customTypecastTitles.end())
123 return typecastTitle->second.c_str();
132 QString separator = (inMenu? QString::fromUtf8(
" → ") :
" ");
133 return typecastInPortName + separator + typecastOutPortName;
141 return uncollapsedTypecastNode;
165 return cachedBoundingRect;
168void VuoRendererTypecastPort::updateCachedBoundingRect()
171 cachedBoundingRect = path.controlPointRect();
174 cachedBoundingRect = cachedBoundingRect.united(
getNameRect());
180 cachedBoundingRect.adjust(-1,-1,1,1);
182 cachedBoundingRect = cachedBoundingRect.toAlignedRect();
198 qint64 timeOfLastActivity = ((!
getRenderActivity())? VuoRendererItem::notTrackingActivity :
208 QPainterPath innerTypecastPath =
getPortPath(
false,
true);
209 painter->fillPath(innerTypecastPath, colors->
nodeFill());
215 painter->drawText(textRect, Qt::AlignLeft, getCanvasTypecastTitle());