| 160 | } |
| 161 | |
| 162 | void |
| 163 | BackdropGuiPrivate::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 | |
| 195 | NATRON_NAMESPACE_EXIT |
| 196 |
no test coverage detected