Search code examples
qmlblackberry-10blackberry-cascades

Blackberry cascades does not show qml file with TabbedPane


I have a TabbedPane layout in a QML file, which is added in another QML file:

attachedObjects: [
        ComponentDefinition {
            id: attachmentViewer
            source: "EncryptedAttachmentViewer.qml"
        }
    ]

This is the file contents:

import bb.cascades 1.0

TabbedPane {
    showTabsOnActionBar: true
    Tab {
        title: "Text"
        Page {
            id:page1

            Label {
                text: _messages.messageViewer.attachment.text
                multiline: true
            }
        }
    }
    Tab {
        title: "HTML"
        Page {
            id: page2
            ListView {
                dataModel: _messages.messageViewer.attachment.htmllist
                listItemComponents: [
                    ListItemComponent {
                        type: "item"

                        Container {
                            WebView {
                                html: ListItemData.html

                            }
                        }
                    }
                ]
            }
        }
    }
    Tab {
        title: "Attachments"
        Page {
            id: page3
            ListView {
                dataModel: _messages.messageViewer.attachment.attachmentlist
                listItemComponents: [
                    ListItemComponent {
                        type: "item"

                        Container {
                            id: itemRoot

                            Label {
                                text: ListItemData.name
                            }
                        }
                    }
                ]
                onTriggered: {
                    _messages.messageViewer.invoke(dataModel.data(indexPath).tmpfilename)
                }
            }
        }
    }
}

Before this was a sequential layout, but because of the Webview in ScrollView bug (webview has near infinite length), I want to migrate to a tabbed layout. So the only thing that has changed is the QML in this one file, and all the elements in it worked before when they were in a scrollview (except the webview, as explained).

When I trigger the load of this file, with navigationPane.push(attachmentViewer.createObject()); in the parent qml file, nothing happens. There are no messages in the console, but the layout does not load, whereas it did before with none. Is there something about TabbedPanes that disallows it not being loaded first?


Solution

  • A TabbedPane is designed to be the first Page of your application. Pushing it into a NavigationPane is not supported.

    You can use a SegmentedControl instead.

    By the way, the bug happens in fact with the WebView in a ListView, not a Webview in a ScrollView. If it can help to design your screen.