2012-11-29 43 views
1

我已经写在BB-10 onClick功能,同时点击我能不能推动上点击功能黑莓10级联的onclick不工作

NavigationPane { 
    id: navigationPane 
    Button { 
     text: "LOG IN" 
     onClicked: { 
      var test = screen.createObject(); 
      navigationPane.push(test); 
     } 

     attachedObjects: ComponentDefinition { 
      id: screen 
      source: "y.qml" 
     } 
    } 
} 

代码另一个QML文件y.qml如下

NavigationPane { 
    id:navigationPane 

    Page { 
     Container { 
      ImageButton { 
       defaultImageSource: "asset:///tabs/home_unf.png" 
       pressedImageSource: "asset:///tabs/home.png" 
       disabledImageSource: "asset:///group.png" 

       onClicked: { 
        var _home = home.createObject() 
        navigationPane.push(_home); 
       } 
      } 
     } 

     attachedObjects: [ 
      ComponentDefinition { 
       id: home 
       source: "z.qml" 
      } 
     ] 
    } 
} 

我不能看见的y.qml同时点击(text: "LOG IN"),并同时点击图像按钮,我定义去z.qml页面,任何人都可以发送一些解决方案(代码示例),来解决这个问题?由于

回答

1

你不能能推一个navigationPane到其它这里是样品

x.qml

NavigationPane { 
    id: navigationPane 

    Button { 
     text: "LOG IN" 
     onClicked: { 
      var test = screen.createObject(); 
      navigationPane.push(test); 
     } 

     attachedObjects: ComponentDefinition { 
      id: screen 
      source: "y.qml" 
     } 
    } 
} 

您的y.qml

Page { 
    Container { 
     ImageButton { 
     defaultImageSource: "asset:///tabs/home_unf.png" 
      pressedImageSource: "asset:///tabs/home.png" 
      disabledImageSource: "asset:///group.png" 

      onClicked: { 
       var _home = home.createObject() 
       navigationPane.push(_home); 
      } 
     } 
    } 

    attachedObjects: [ 
     ComponentDefinition { 
      id: home 
      source: "z.qml" 
     } 
    ] 
} 

与致电z.qml相同

+0

其工作正常 – Apple

0

不应该直接有按钮上NaviagationPane更改main.qml到

NavigationPane 
{ 
    id: navigationPane 
    Page 
    { 
     Container 
     { 
      Button 
      { 
       text: "LOG IN" 
       onClicked: 
       { 
        var test = screen.createObject(); 
        navigationPane.push(test); 
       } 
       attachedObjects: ComponentDefinition 
       { 
        id: screen 
        source: "y.qml" 
       } 
      } 
     } 
    } 
}