Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.1.1, 5.9.3
-
None
-
Windows
-
127c79fb7fda16b9a48ce8c425d1700d1aa7502d (qt/qtdeclarative/dev) 2fee8f1f310406af41fd104892be012d4e633b94 (qt/qtdeclarative/6.0) c24757f1b642102852beb1f62c83bfd76ca31567 (qt/tqtc-qtdeclarative/tqtc/lts-5.15), 235bbe8c6 (dev), 892576b74 (6.7)
Description
When the elide property of Text is set to Text.ElideRight, it is possible to break the Text component such that the text disappears and cannot reappear unless it is re-set. Using the following code, clicking on the Item area will cause the text to disappear and never reappear.
Removing the elide value or using any other value does not reproduce this behavior.
Also note that both width AND height must be set to 0 to reproduce the behavior. If you set only one to 0, the text does not disappear. Likewise if you set height to 0 then reset it to parent.height, THEN set width to 0 and reset it to parent.width, you cannot reproduce this behavior.
This becomes a larger issue when dynamically creating objects that contain Text elements. The dynamically created object may have a 0 height and width at creation, especially if anchoring is being used, and then get set to valid values after completion.
Example Code:
import QtQuick 2.1 Item { anchors.fill: parent Text { id: iText width: parent.width height: parent.height elide: Text.ElideRight text: 'Testing some long text that should get trimmed' color: 'white' } MouseArea { anchors.fill: parent onClicked: { iText.height = 0; iText.width = 0; iText.height = parent.height; iText.width = parent.width; console.log( "Height: " + iText.height + "Width: " + iText.width ); } } }
Attachments
Issue Links
- is duplicated by
-
QTBUG-83408 Text disappears with ElideRight.
-
- Closed
-
- relates to
-
QTBUG-76229 DialogButtonBox custom button's text not visible
-
- Closed
-
For Gerrit Dashboard: QTBUG-33608 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
329980,5 | Fix Text with ElideRight not being rendered when width goes from 0 to >0 | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
329992,2 | Fix Text with ElideRight not being rendered when width goes from 0 to >0 | 6.0 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
329993,2 | Fix Text with ElideRight not being rendered when width goes from 0 to >0 | tqtc/lts-5.15 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |
554147,2 | Fix Text with ElideRight rendering when margins are set | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
554752,2 | Fix Text with ElideRight rendering when margins are set | 6.7 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
554799,2 | Fix Text with ElideRight rendering when margins are set | tqtc/lts-6.5 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |
554801,2 | Fix Text with ElideRight rendering when margins are set | tqtc/lts-6.2 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |