0
私はメッセンジャーを持っています。私は自分のメッセージを左側の右側のメッセージとクライアントのメッセージにします。メッセージはリストビューに追加されます。QMLリストビューのアンカー
ListView {
id: listview
Layout.fillWidth: true
Layout.fillHeight: true
model: messageModel
delegate: ItemDelegate
{
text: model.message
checked: true
font.family: "Comic Sans MS"
font.pixelSize: 15
anchors.right: parent.right
}
}
私のメッセージは正しいです。
TextField {
id: textField
Material.accent: Material.Purple
font.family: "Comic Sans MS"
Layout.fillWidth: true; Layout.fillHeight: true
placeholderText: "Write a message..."
background: null
focus: true
Keys.onPressed: {
if (event.key == Qt.Key_Enter && textField.text != "") {
listview.anchors.right = parent.right
messageModel.append({message: textField.text});
textField.text = ""
listview.positionViewAtEnd()
}
}
}
listview.anchorsは何もしませんか?
私は知っていますが、アンカーにアクセスしたい場合はどうすればよいですか。デリゲートの外から? – Someone
コード例、 – folibis
上記のコード!私はif節でListviewにアクセスしたい。 – Someone