2013-08-14 3 views
-3

내 QML :액세스 컨텍스트 속성

내가 버튼을 생성하고 호출하는 경우 "_model.writeapp (APPNAME);" 자사의 클릭 이벤트에서 컨텍스트가 정의

목록보기 확인란 oncheckedchanged 이벤트에서 잘 작동하지만

Container { 
ListView { 
    id: listid 
    dataModel: _model 

    function getAppName() { 
     return (_model.readApp()); 
    } 

    function writeappName(appname) { 
     _model.writeapp(appname); 
    } 
    //! [1] 

    listItemComponents: [ 
     ListItemComponent { 
      id: listcomp 
      type: "item" 
      Container { 
       id: conchk 
       CheckBox { 
        id: chkbx 
        text: ListItemData.appname 
        onCheckedChanged: { 
         console.log("checked") 
         if (checked) { 
          //have to call  _model.writeapp(appname); 
          chkbx.ListItem.view.writeappName("hi")         
         } 
        } 
       } 
      } 
     } 
    ] 
} 

}

답변

1

이 변경 시도 : 여기에

chkbx.ListItem.view.writeappName("hi") 

:

conchk.ListItem.view.writeappName("hi") 
+0

투표를 통해이 문제를 해결할 수 있다면 받아들이십시오. – krilovich