qt - listview doesn't appear in TabGroup QML? -
how can make listview in qml appear in tab . use code in application n9(meego) need use in symbian . made changes when transformed meego symbian no listview appears. please . note : same listview appears when don't use tabs !!!
my code:
import qtquick 1.1 import com.nokia.symbian 1.1 import com.nokia.extras 1.1 import "uiconstants.js" uiconstants page { id: mainpage orientationlock: pageorientation.lockportrait tools: tabbar { // platformstyle: tabbuttonstyle { } tabbutton { text: "tab 1" tab: tab1 } tabbutton { text: "tab 2" tab: tab2 } tabbutton { text: "tab 3" tab: tab3 } tabbutton { text: "tab 4" tab: tab4 } } tabgroup { id: tabgroup pagestack { id: tab1 component.oncompleted: tab1.push(listpage) // define content tab 1 page { id: listpage item { id: testlist anchors.fill: parent function openfile(file) { var component = qt.createcomponent(file) if (component.status == component.ready) { mainwindow.pagestack.push(component); console.log("loading component okay"); } else { console.log("error loading component:", component.errorstring()); } } listmodel { id: pagesmodel listelement { page: "infobannerpage.qml" title: "infobanner" subtitle: "info banner" } listelement { page: "ratingindicator.qml" title: "ratingindicator" subtitle: "indicates ratings" } } listview { id: list model: pagesmodel anchors.fill: parent delegate: listitem { id: listitem platforminverted: mainwindow.childreninverted row { id: listitemrow column { listitemtext { id: maintext // width: listitemrow.width role: "title" text: title } listitemtext { id: subtext // width: listitemrow.width role: "subtitle" text: subtitle visible: text != "" } } } onclicked: { testlist.openfile(page); } } // listitem } // listview scrolldecorator { flickableitem: listpage platforminverted: mainwindow.childreninverted } } // item } // page } page { id: tab2 } page { id: tab3 } page { id: tab4 } }
}
you have issues layouting.
working one:
import qtquick 1.1 import com.nokia.symbian 1.1 import com.nokia.extras 1.1 page { id: mainpage orientationlock: pageorientation.lockportrait // tools: tabbar { id: tabbar anchors {top: parent.top } // platformstyle: tabbuttonstyle { } tabbutton { text: "tab 1" tab: tab1 } tabbutton { text: "tab 2" tab: tab2 } tabbutton { text: "tab 3" tab: tab3 } tabbutton { text: "tab 4" tab: tab4 } } tabgroup { id: tabgroup anchors {top: tabbar.bottom; bottom: parent.bottom} pagestack { id: tab1 component.oncompleted: tab1.push(listpage) // define content tab 1 page { id: listpage anchors.fill: parent item { id: testlist anchors.fill: parent function openfile(file) { var component = qt.createcomponent(file) if (component.status == component.ready) { mainwindow.pagestack.push(component); console.log("loading component okay"); } else { console.log("error loading component:", component.errorstring()); } } listmodel { id: pagesmodel listelement { page: "infobannerpage.qml" title: "infobanner" subtitle: "info banner" } listelement { page: "ratingindicator.qml" title: "ratingindicator" subtitle: "indicates ratings" } } listview { id: list model: pagesmodel anchors.fill: parent delegate: listitem { id: listitem // platforminverted: mainwindow.childreninverted row { id: listitemrow anchors.fill: listitem.paddingitem column { listitemtext { id: maintext // width: listitemrow.width role: "title" text: title } listitemtext { id: subtext // width: listitemrow.width role: "subtitle" text: subtitle visible: text != "" } } } onclicked: { testlist.openfile(page); } } // listitem } // listview scrolldecorator { // flickableitem: listpage // platforminverted: mainwindow.childreninverted } } // item } // page } page { id: tab2 } page { id: tab3 } page { id: tab4 } } }
Comments
Post a Comment