2012-08-22 148 views
2

我正在編寫一些類,它擴展了QObject並且很少有Q_PROPERTY我在QList中使用QAbstaction模型中的一個Role(總是返回QObject *); 在QML我向綁定文本編輯屬性,如:從qml編輯QObject屬性

Binding 
{ 
    target :currentReport 
    property: description 
    value: text_description_edit.text 
} 

但該條目返回的錯誤,而不是我的屬性綁定:

file:///..somePath../ReportAddDelegate.qml:179: ReferenceError: Can't find variable: description 

我怎麼能在QML編輯我的QObject的財產?

UPD: IM使用property QtObject currentReport在委派組件

//對不起我的英語

+1

顯示屬性'description'的定義。它應該有'WRITE','READ'和'NOTIFY'部分。 –

+0

是的,它有 Q_PROPERTY(QString的描述寫setDescription READ getDescription NOTIFY descriptionChanged) – Dcow

+0

順便說一句,如果我寫這樣的: 文本編輯 {... 文本:curretnReport.description } 那我也沒有錯誤,並我在TextEdit中看到了文本,但是如果我編輯它,我不會編輯對象 – Dcow

回答

1

解決了! 我在綁定中犯錯誤! 需要寫property: "description"代替property: description

+0

中的說明屬性! –