简体   繁体   中英

QML ListView : “complex” delegate causes crash

Having problems with my app I've searched the web for something (even remotely) similiar and found this : Remove rows from QAbstractListModel (the code provided in the answer) - it works great! But when I change the ListView delegate to something more "complicated", like this :

Component {
        id: commonDelegate
        Rectangle {
            width: view.width
            implicitHeight: editor.implicitHeight + 10
            color: "transparent"
            border.color: "red"
            border.width: 2
            radius: 5
            TextInput {
                id: editor
                anchors.margins: 1.5 * parent.border.width
                anchors.left: parent.left
                text: edit.name // "edit" role of the model, to break the binding loop
                onTextChanged: {
                    display.name = text;
                    model.display = display
                }
            }

            ComboBox {
                id: siema
                anchors.left: editor.right
                model: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "+"]
            }

            Button {
                id: bt
                text: "Guizk"
                anchors.left: siema.right
                anchors.right: parent.right
            }

        }
    }

then the application crashes after adding some rows (enought to fill the whole screen, so that some of them are not visible) and trying to scroll to those invisible rows. When running with the debugger the error reported is EXC_BAD_ACCESS and there is disassembly shown in Creator for function QCoreApplication::proccessEvents.

Is there a limit on how "complex" the delegate can be? Or is there a better (more efficient) way of doing it, so that it won't crash?

The crash occurs on Windows 7 64bit, OsX 10.8.5 and Android 4.1

Let me know if you need more information.

I have the same problem, throu trial and error I found out, that the Combobox is responsable for the crash.

If you can live without it, try not to use it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM