[Development] ListView + TextEdit tricky behavior

Keith Gardner kreios4004 at gmail.com
Tue Sep 30 15:09:04 CEST 2014


On Tue, Sep 30, 2014 at 7:55 AM, Matías Néstor Ares <matnares at gmail.com>
wrote:

> Hi everyone!
> I'm developing an app with Qt, and I'm having some issues.
> I don't get a proper answer from the forums yet.
> So I ask it here, sorry if it is not the correct place.
>
> The problem description is on this post:
> http://qt-project.org/forums/viewthread/47948/
> And a video of the symptom here:
> https://www.youtube.com/watch?v=1sHKnNZLzhs
>
> Thanks In Advance
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
>
Matias,

I think the problem is that you are expecting your items to retail the
typed text instead of your model.  I think the ListView destroys delegates
that are not within the view.  Since your model is not retaining the typed
text, this would explain why it is going away.  I modified your delegate to
show that this is the problem.

delegate: Item {
    width: 100
    height: 40

    Component.onDestruction: {
        console.debug("Item destroyed")
    }

    Rectangle {
        width: 100
        height: 40
        color: colorCode
        TextEdit {

            font.pointSize: 23
            anchors.fill: parent

            font.bold: true
            anchors.verticalCenter: parent.verticalCenter
        }
    }
}

Keith
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140930/c4531fe2/attachment.html>


More information about the Development mailing list