From b66fc29fb771c216f12e397861ef1d67d091a028 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 3 Jul 2023 08:18:06 +0200 Subject: [PATCH] doc: Make docs for ElideNone a bit more precise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ElideNone was originally introduced as a way of modifying behavior of specific widgets, such as QTabBar. The text would previously always be a elided and an ellipsis character would be added somewhere to indicate this to the user. Given that context, it makes sense that the documentation says the effect of ElideNone is that ellipsis does not appear in the text, since the text would still be elided if it were too long, given that the painter would draw it clipped to the widget. When QFontMetrics::elidedText() was introduced later, this became more confusing. In the context of this function, you would expect the text to be returned truncated to the width but without the ellipsis character. Instead it just returns the full string. Since this has been the effect of ElideNone since the start and multiple places use it as a way of disabling the truncation of the string, we simply update the documentation to make this more clear. Fixes: QTBUG-40315 Change-Id: If037430da6260020b1d99be7bd43e622f8afa844 Reviewed-by: Tor Arne Vestbø (cherry picked from commit e7507d6cb706d28954343723438c4fc7d6fe5ba4) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/global/qnamespace.qdoc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 86ec1aee51a..d5731d66baf 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2874,7 +2874,10 @@ \value ElideLeft The ellipsis should appear at the beginning of the text. \value ElideRight The ellipsis should appear at the end of the text. \value ElideMiddle The ellipsis should appear in the middle of the text. - \value ElideNone Ellipsis should NOT appear in the text. + \value ElideNone Ellipsis should NOT appear in the text. When passed to functions such as + QFontMetrics::elidedText(), this will cause the full string to return unless + the text contains multi-length variants. Elision in this case must be done + by clipping to the component width. Qt::ElideMiddle is normally the most appropriate choice for URLs (e.g., "\l{http://bugreports.qt.io/browse/QTWEBSITE-13}{http://bugreports.qt.../QTWEBSITE-13/}"),