MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / refreshLabelText

Method refreshLabelText

Gui/BackdropGui.cpp:162–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162void
163BackdropGuiPrivate::refreshLabelText(int nameHeight,
164 const QString &text)
165{
166 QString textLabel = text;
167
168 textLabel.replace( QString::fromUtf8("\n"), QString::fromUtf8("<br>") );
169 textLabel.prepend( QString::fromUtf8("<div align=\"left\">") );
170 textLabel.append( QString::fromUtf8("</div>") );
171 QFont f;
172 QColor color;
173 if ( !text.isEmpty() ) {
174 KnobGuiString::parseFont(textLabel, &f, &color);
175 bool antialias = appPTR->getCurrentSettings()->isNodeGraphAntiAliasingEnabled();
176 if (!antialias) {
177 f.setStyleStrategy(QFont::NoAntialias);
178 }
179 label->setFont(f);
180 }
181
182 label->setHtml(textLabel);
183
184
185 QRectF bbox = _publicInterface->boundingRect();
186
187 //label->adjustSize();
188 int w = std::max( bbox.width(), label->textWidth() * 1.2 );
189 QRectF labelBbox = label->boundingRect();
190 int h = std::max( labelBbox.height() + nameHeight + TO_DPIX(10), bbox.height() );
191 _publicInterface->resize(w, h);
192 _publicInterface->update();
193}
194
195NATRON_NAMESPACE_EXIT
196

Callers 2

onLabelChangedMethod · 0.80

Calls 11

maxFunction · 0.85
appendMethod · 0.80
getCurrentSettingsMethod · 0.80
setFontMethod · 0.80
isEmptyMethod · 0.45
boundingRectMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
resizeMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected