Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
QSR 2.1, QSR 2.2
-
None
Description
If text is set using property, the property name is used in boundary check calculation.
See the following code text->text()
QString QSafeTextGenerator::generateTextLayout(const Node *node, QSize &size, const Text *text) { auto metrics = QFontMetrics(text->font()); QRect boundingRect = metrics.boundingRect(text->text()); const qint32 actualHeight = boundingRect.height(); const qint32 actualWidth = boundingRect.width(); if (actualHeight > size.height() || actualWidth > size.width()) { QDebug err = qCriticalContext(text->text().context()); err.setAutoInsertSpaces(false); err << "The actual text area of the SafeText " << node->id() << " ("<< actualWidth << '*' << actualHeight << ") does not fit into the defined text area (" << size.width() << '*' << size.height() << ") for runtime-editable text. Overflowing text: " << text; return QString(); }
Instead, we should first evaluate the text value in JSEngine: QJSValue textValue = m_engine->evaluate(text->text());
Overall, we should reconsider whether doing a boundary check for the dynamic text makes sense.