[Development] Text clipping in QtQuick 2.0

Todd.Rose at nokia.com Todd.Rose at nokia.com
Tue Jan 17 16:59:19 CET 2012


:-)   In my defense I was surprised that it wasn't already reported so I thought maybe I was doing something wrong.  FWIW you can work around it for now by putting the Text inside a Rectangle with clip: true.

BR,
Todd

> -----Original Message-----
> From: development-bounces+todd.rose=nokia.com at qt-project.org
> [mailto:development-bounces+todd.rose=nokia.com at qt-project.org] On
> Behalf Of Alpert Alan (Nokia-MP/Brisbane)
> Sent: Tuesday, January 17, 2012 5:14 AM
> To: development at qt-project.org
> Subject: Re: [Development] Text clipping in QtQuick 2.0
> 
> Clipping has never been enabled by default (not even in QtQuick 1.x). An
> important detail he left out of the description (though not the example) was
> that he explicitly set clip: true on the Text element.
> 
> This does make him seen extremely open minded to consider clip: true not
> clipping as a 'feature' ;). If I saw that behavior I'd file it in JIRA directly.
> 
> --
> Alan Alpert
> 
> On Tue, 17 Jan 2012 20:01:50 ext lars.knoll at nokia.com wrote:
> > Isn't this mostly because we don't cache text in textures anymore in Qt5?
> >
> > Enabling clipping be default on all Text elements would cause a
> > performance hit, so I'm not sure this should be enabled by default.
> >
> > Cheers,
> > Lars
> >
> > On 1/17/12 7:30 AM, "ext andrew.den-exter at nokia.com"
> >
> > <andrew.den-exter at nokia.com> wrote:
> > >It¹s a bug.  https://bugreports.qt.nokia.com/browse/QTBUG-23670
> > >
> > >Specifically items are being clipped to their boundingRect¹s, for
> > >which some item¹s  quite logically return their painted size and so
> > >are never clipped.  Text and Image are I think the only ones that do this.
> > >
> > >Andrew
> > >
> > >From: development-bounces+andrew.den-exter=nokia.com at qt-
> project.org
> > >[mailto:development-bounces+andrew.den-exter=nokia.com at qt-
> project.org
> > >] On Behalf Of Rose Todd (Nokia-M/Alpharetta)
> > >Sent: Tuesday, January 17, 2012 3:42 PM
> > >To: development at qt-project.org
> > >Subject: Re: [Development] Text clipping in QtQuick 2.0
> > >
> > >
> > >
> > >Doh!  That should read ³Text elementsŠare *not* being clippedŠ²
> > >
> > >From:development-bounces+todd.rose=nokia.com at qt-project.org
> > >[mailto:development-bounces+todd.rose=nokia.com at qt-project.org]
> > ><mailto:[mailto:development-bounces+todd.rose=nokia.com at qt-
> project.or
> > >g]>
> > >On Behalf Of
> > >ext Todd.Rose at nokia.com
> > >Sent: Tuesday, January 17, 2012 12:34 AM
> > >To: development at qt-project.org
> > >Subject: [Development] Text clipping in QtQuick 2.0
> > >
> > >
> > >
> > >Text elements with wrapMode: Text.NoWrap are being clipped when the
> text
> > >painted width exceeds the element width.   Seems like a big regression
> > >from QtQuick1.xŠis this a known issue?  Bug? Feature?
> > >
> > >
> > >Simple example:
> > >
> > >
> > >TextBug.qml
> > >
> > >import QtQuick 2.0Rectangle {    width: 360    height: 360    Rectangle {
> > >
> > >       id: leftRect        anchors.left: parent.left        anchors.top:
> > >parent.top        anchors.bottom: parent.bottom        width: 60
> > >color: "red"    }    Rectangle {        id: rightRect
> > >anchors.right: parent.right        anchors.top: parent.top
> > >anchors.bottom: parent.bottom        width: 60        color: "red"    }
> > >
> > > Text {        id: bugText        anchors.left: leftRect.right
> > >
> > >anchors.right: rightRect.left        anchors.verticalCenter:
> > >parent.verticalCenter        wrapMode: Text.NoWrap        font.pointSize:
> > >16        clip: true        text: "Hello World! Hello World! Hello World!
> > >Hello World! Hello World! Hello World! Hello World! Hello World! Hello
> > >World! Hello World!"    }    MouseArea {        anchors.fill: parent
> > >
> > >  onClicked: {            if (bugText.wrapMode == Text.NoWrap)
> > >
> > >    bugText.wrapMode = Text.WordWrap            else
> > >
> > >bugText.wrapMode = Text.NoWrap        }    }}
> > >
> > >
> > >
> > >
> > >
> > >_______________________________________________
> > >Development mailing list
> > >Development at qt-project.org
> > >http://lists.qt-project.org/mailman/listinfo/development
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development



More information about the Development mailing list